1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

fix issue reporting when baseline already exists (#5838)

This commit is contained in:
orklah 2021-05-28 15:43:15 +02:00 committed by GitHub
parent b259296457
commit 276d355ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -718,9 +718,16 @@ require_once __DIR__ . '/' . 'Psalm/IssueBuffer.php';
"\n}\n");
}
$issue_baseline = [];
if (isset($options['set-baseline']) && is_string($options['set-baseline'])) {
fwrite(STDERR, 'Writing error baseline to file...' . PHP_EOL);
$issue_baseline = ErrorBaseline::read(
new \Psalm\Internal\Provider\FileProvider,
$options['set-baseline']
);
ErrorBaseline::create(
new \Psalm\Internal\Provider\FileProvider,
$options['set-baseline'],
@ -739,8 +746,6 @@ require_once __DIR__ . '/' . 'Psalm/IssueBuffer.php';
fwrite(STDERR, PHP_EOL);
}
$issue_baseline = [];
if (isset($options['update-baseline'])) {
$baselineFile = Config::getInstance()->error_baseline;
@ -786,7 +791,7 @@ require_once __DIR__ . '/' . 'Psalm/IssueBuffer.php';
$baseline_file_path = Config::getInstance()->error_baseline;
}
if ($baseline_file_path && !isset($options['ignore-baseline'])) {
if (!$issue_baseline && $baseline_file_path && !isset($options['ignore-baseline'])) {
try {
$issue_baseline = ErrorBaseline::read(
new \Psalm\Internal\Provider\FileProvider,