Skip to content

Commit

Permalink
Fix empty Compact Report
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-tech committed Oct 6, 2024
1 parent d747f65 commit 0843b9c
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 @@ -8,7 +8,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 @@ -31,7 +30,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 @@ -72,12 +71,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 0843b9c

Please sign in to comment.