Skip to content

Commit ca888d6

Browse files
Improve
1 parent 2f06794 commit ca888d6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Command/ErrorFormatter/GithubErrorFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private function formatMessage(string $message): string
7676
// see https://github.com/actions/starter-workflows/issues/68#issuecomment-581479448
7777
$message = str_replace("\n", '%0A', $message);
7878

79-
return preg_replace('/@([a-zA-Z0-9_\-]+)/', '`@$1`', $message) ?? $message;
79+
return preg_replace('/(^|\s)@([a-zA-Z0-9_\-]+)(\s|$)/', '$1`@$2`$3', $message) ?? $message;
8080
}
8181

8282
}

src/Testing/ErrorFormatterTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function getAnalysisResult(array|int $numFileErrors, int $numGenericEr
103103
new Error("Bar\nBar2", self::DIRECTORY_PATH . '/folder with unicode 😃/file name with "spaces" and unicode 😃.php', 2),
104104
new Error("Bar\nBar2", self::DIRECTORY_PATH . '/foo.php', null),
105105
new Error('Foobar\\Buz', self::DIRECTORY_PATH . '/foo.php', 5, tip: 'a tip', identifier: 'foobar.buz'),
106-
new Error('Error with @param or @phpstan-param and @return in the message.', self::DIRECTORY_PATH . '/bar.php', 5),
106+
new Error('Error with @param or @phpstan-param and class@anonymous in the message.', self::DIRECTORY_PATH . '/bar.php', 5),
107107
], $offsetFileErrors, $numFileErrors);
108108

109109
$genericErrors = array_slice([

tests/PHPStan/Command/ErrorFormatter/GithubErrorFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function dataFormatterOutputProvider(): iterable
8080
1,
8181
[6, 1],
8282
0,
83-
'::error file=bar.php,line=5,col=0::Error with `@param` or `@phpstan-param` and `@return` in the message.
83+
'::error file=bar.php,line=5,col=0::Error with `@param` or `@phpstan-param` and class@anonymous in the message.
8484
',
8585
];
8686
}

0 commit comments

Comments
 (0)