Skip to content

Commit

Permalink
Do not include TOKEN_PHPDOC_EOL in node tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Apr 24, 2023
1 parent 39e4966 commit ecb7789
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/Parser/PhpDocParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ private function enrichWithAttributes(TokenIterator $tokens, Ast\Node $tag, int
if ($tokensArray[$endIndex][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) {
$endIndex--;
}
} elseif ($tokensArray[$endIndex][Lexer::TYPE_OFFSET] === Lexer::TOKEN_PHPDOC_EOL) {
$endIndex--;
}

$tag->setAttribute(Ast\Attribute::START_INDEX, $startIndex);
Expand Down
18 changes: 9 additions & 9 deletions tests/PHPStan/Parser/PhpDocParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5540,8 +5540,8 @@ public function dataLinesAndIndexes(): iterable
* @param Bar $bar 2nd multi world description
*/',
[
[2, 2, 2, 16],
[3, 3, 17, 31],
[2, 2, 2, 15],
[3, 3, 17, 30],
],
];

Expand All @@ -5560,13 +5560,13 @@ public function dataLinesAndIndexes(): iterable
* ))
*/',
[
[2, 2, 2, 9],
[3, 3, 10, 13],
[4, 4, 14, 43],
[5, 5, 44, 44],
[6, 6, 45, 50],
[7, 7, 51, 51],
[8, 12, 52, 115],
[2, 2, 2, 8],
[3, 3, 10, 12],
[4, 4, 14, 42],
[5, 5, 44, 43],
[6, 6, 45, 49],
[7, 7, 51, 50],
[8, 12, 52, 114],
],
];

Expand Down

0 comments on commit ecb7789

Please sign in to comment.