mirror of
https://github.com/danog/phpdoc-parser.git
synced 2025-01-23 06:12:09 +01:00
Fixed "Undefined array key -1"
This commit is contained in:
parent
4136e0056a
commit
cf4fc7d2ae
@ -124,7 +124,7 @@ class TokenIterator
|
||||
|
||||
public function getSkippedHorizontalWhiteSpaceIfAny(): string
|
||||
{
|
||||
if ($this->tokens[$this->index - 1][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) {
|
||||
if ($this->index > 0 && $this->tokens[$this->index - 1][Lexer::TYPE_OFFSET] === Lexer::TOKEN_HORIZONTAL_WS) {
|
||||
return $this->tokens[$this->index - 1][Lexer::VALUE_OFFSET];
|
||||
}
|
||||
|
||||
|
@ -3410,6 +3410,19 @@ Finder::findFiles('*.php')
|
||||
''
|
||||
),
|
||||
],
|
||||
[
|
||||
'@var',
|
||||
'$foo string[]',
|
||||
new InvalidTagValueNode(
|
||||
'$foo string[]',
|
||||
new \PHPStan\PhpDocParser\Parser\ParserException(
|
||||
'$foo',
|
||||
Lexer::TOKEN_VARIABLE,
|
||||
0,
|
||||
Lexer::TOKEN_IDENTIFIER
|
||||
)
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user