Skip to content

Commit 97281a7

Browse files
authored
TableErrorFormatter: visually differentiate phpstan assertion errors from rule errors
1 parent 7489a09 commit 97281a7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Command/ErrorFormatter/TableErrorFormatter.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use function count;
1414
use function explode;
1515
use function getenv;
16+
use function in_array;
1617
use function is_string;
1718
use function ltrim;
1819
use function sprintf;
@@ -117,6 +118,14 @@ public function formatErrors(
117118

118119
$message .= "\n✏️ <href=" . OutputFormatter::escape($url) . '>' . $title . '</>';
119120
}
121+
122+
if (
123+
$error->getIdentifier() !== null
124+
&& in_array($error->getIdentifier(), ['phpstan.type', 'phpstan.nativeType', 'phpstan.variable', 'phpstan.dumpType', 'phpstan.unknownExpectation'], true)
125+
) {
126+
$message = '<fg=red>' . $message . '</>';
127+
}
128+
120129
$rows[] = [
121130
$this->formatLineNumber($error->getLine()),
122131
$message,

0 commit comments

Comments
 (0)