From 276d355ebb7c435b7dce37425715df1c29cfc790 Mon Sep 17 00:00:00 2001 From: orklah Date: Fri, 28 May 2021 15:43:15 +0200 Subject: [PATCH] fix issue reporting when baseline already exists (#5838) --- src/psalm.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/psalm.php b/src/psalm.php index f9b0dce3a..957ae2374 100644 --- a/src/psalm.php +++ b/src/psalm.php @@ -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,