Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty compact report if baseline file is used #11111

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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