Skip to content

Commit c84a072

Browse files
committed
Parsing @phpstan-ignore - allow comma in description
1 parent 3361c84 commit c84a072

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Parser/RichParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ private function parseIdentifiers(string $text, int $ignorePos): array
299299
if ($i === 0) {
300300
throw new IgnoreParseException('First token is not an identifier', $tokenLine);
301301
}
302-
if ($tokenType === IgnoreLexer::TOKEN_COMMA) {
302+
if ($tokenType === IgnoreLexer::TOKEN_COMMA && $depth === 0) {
303303
throw new IgnoreParseException('Unexpected comma (,)', $tokenLine);
304304
}
305305
if ($tokenType === IgnoreLexer::TOKEN_CLOSE_PARENTHESIS) {

tests/PHPStan/Parser/RichParserTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ public function dataLinesToIgnore(): iterable
8585
],
8686
];
8787

88+
yield [
89+
'<?php' . PHP_EOL .
90+
'test(); // @phpstan-ignore return.ref, return.non (foo, because...)',
91+
[
92+
2 => ['return.ref', 'return.non'],
93+
],
94+
];
95+
8896
yield [
8997
'<?php' . PHP_EOL .
9098
'test(); // @phpstan-ignore return.ref, return.non čičí',

0 commit comments

Comments
 (0)