Skip to content

TableErrorFormatter: Use two spaces instead of one #4031

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

Merged
merged 1 commit into from
May 30, 2025
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/Command/ErrorFormatter/TableErrorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function formatErrors(
$filePath = $error->getTraitFilePath() ?? $error->getFilePath();
if ($error->getIdentifier() !== null && $error->canBeIgnored()) {
$message .= "\n";
$message .= '🪪 ' . $error->getIdentifier();
$message .= '🪪 ' . $error->getIdentifier();
}
if ($error->getTip() !== null) {
$tip = $error->getTip();
Expand All @@ -94,11 +94,11 @@ public function formatErrors(
if (str_contains($tip, "\n")) {
$lines = explode("\n", $tip);
foreach ($lines as $line) {
$message .= '💡 ' . ltrim($line, ' •') . "\n";
$message .= '💡 ' . ltrim($line, ' •') . "\n";
}
$message = rtrim($message, "\n");
} else {
$message .= '💡 ' . $tip;
$message .= '💡 ' . $tip;
}
}
if (is_string($this->editorUrl)) {
Expand All @@ -118,7 +118,7 @@ public function formatErrors(
$title = $this->relativePathHelper->getRelativePath($filePath);
}

$message .= "\n✏️ <href=" . OutputFormatter::escape($url) . '>' . $title . '</>';
$message .= "\n✏️ <href=" . OutputFormatter::escape($url) . '>' . $title . '</>';
}

if (
Expand Down
36 changes: 18 additions & 18 deletions tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ public function dataFormatterOutputProvider(): iterable
4 Foo
------ -------------------------------------------------------------------

------ ----------
------ -----------
Line foo.php
------ ----------
------ -----------
1 Foo<Bar>
5 Bar
Bar2
💡 a tip
------ ----------
💡 a tip
------ -----------

[ERROR] Found 4 errors

Expand Down Expand Up @@ -143,14 +143,14 @@ public function dataFormatterOutputProvider(): iterable
4 Foo
------ -------------------------------------------------------------------

------ ----------
------ -----------
Line foo.php
------ ----------
------ -----------
1 Foo<Bar>
5 Bar
Bar2
💡 a tip
------ ----------
💡 a tip
------ -----------

-- -----------------------
Error
Expand Down Expand Up @@ -190,13 +190,13 @@ public function dataFormatterOutputProvider(): iterable
'numGenericErrors' => 0,
'verbose' => false,
'extraEnvVars' => [],
'expected' => ' ------ ---------------
'expected' => ' ------ ----------------
Line foo.php
------ ---------------
------ ----------------
5 Foobar\Buz
🪪 foobar.buz
💡 a tip
------ ---------------
🪪 foobar.buz
💡 a tip
------ ----------------


[ERROR] Found 1 error
Expand All @@ -211,13 +211,13 @@ public function dataFormatterOutputProvider(): iterable
'numGenericErrors' => 0,
'verbose' => true,
'extraEnvVars' => [],
'expected' => ' ------ ---------------
'expected' => ' ------ ----------------
Line foo.php
------ ---------------
------ ----------------
5 Foobar\Buz
🪪 foobar.buz
💡 a tip
------ ---------------
🪪 foobar.buz
💡 a tip
------ ----------------


[ERROR] Found 1 error
Expand Down
Loading