Skip to content

Commit ecb7789

Browse files
committed
Do not include TOKEN_PHPDOC_EOL in node tokens
1 parent 39e4966 commit ecb7789

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/Parser/PhpDocParser.php

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ private function enrichWithAttributes(TokenIterator $tokens, Ast\Node $tag, int
133133
if ($tokensArray[$endIndex][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) {
134134
$endIndex--;
135135
}
136+
} elseif ($tokensArray[$endIndex][Lexer::TYPE_OFFSET] === Lexer::TOKEN_PHPDOC_EOL) {
137+
$endIndex--;
136138
}
137139

138140
$tag->setAttribute(Ast\Attribute::START_INDEX, $startIndex);

tests/PHPStan/Parser/PhpDocParserTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -5540,8 +5540,8 @@ public function dataLinesAndIndexes(): iterable
55405540
* @param Bar $bar 2nd multi world description
55415541
*/',
55425542
[
5543-
[2, 2, 2, 16],
5544-
[3, 3, 17, 31],
5543+
[2, 2, 2, 15],
5544+
[3, 3, 17, 30],
55455545
],
55465546
];
55475547

@@ -5560,13 +5560,13 @@ public function dataLinesAndIndexes(): iterable
55605560
* ))
55615561
*/',
55625562
[
5563-
[2, 2, 2, 9],
5564-
[3, 3, 10, 13],
5565-
[4, 4, 14, 43],
5566-
[5, 5, 44, 44],
5567-
[6, 6, 45, 50],
5568-
[7, 7, 51, 51],
5569-
[8, 12, 52, 115],
5563+
[2, 2, 2, 8],
5564+
[3, 3, 10, 12],
5565+
[4, 4, 14, 42],
5566+
[5, 5, 44, 43],
5567+
[6, 6, 45, 49],
5568+
[7, 7, 51, 50],
5569+
[8, 12, 52, 114],
55705570
],
55715571
];
55725572

0 commit comments

Comments
 (0)