Skip to content

Commit

Permalink
Merge pull request #11111 from andrey-tech/issue-10875
Browse files Browse the repository at this point in the history
Fix empty compact report if baseline file is used
  • Loading branch information
danog authored Feb 17, 2025
2 parents f44bf1f + 55a5bc6 commit 8347d5b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Psalm/Report/CompactReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\BufferedOutput;

use function count;
use function implode;
use function str_split;
use function strlen;
Expand All @@ -35,7 +34,7 @@ public function create(): string
$current_file = null;

$output = [];
foreach ($this->issues_data as $i => $issue_data) {
foreach ($this->issues_data as $issue_data) {
if (!$this->show_info && $issue_data->severity === IssueData::SEVERITY_INFO) {
continue;
}
Expand Down Expand Up @@ -76,12 +75,11 @@ public function create(): string
]);

$current_file = $issue_data->file_name;
}

// If we're at the end of the issue sets, then wrap up the last table and render it out.
if ($i === count($this->issues_data) - 1) {
$table->render();
$output[] = $buffer->fetch();
}
if ($buffer !== null) {
$table->render();
$output[] = $buffer->fetch();
}

return implode("\n", $output);
Expand Down

0 comments on commit 8347d5b

Please sign in to comment.