ConstExprParser - throw known exception type

This commit is contained in:
Ondrej Mirtes 2022-04-14 14:24:06 +02:00
parent 34545bb30a
commit d8e9fd97ca
No known key found for this signature in database
GPG Key ID: CF1A108D0E7AE720

View File

@ -2,7 +2,6 @@
namespace PHPStan\PhpDocParser\Parser;
use LogicException;
use PHPStan\PhpDocParser\Ast;
use PHPStan\PhpDocParser\Lexer\Lexer;
use function strtolower;
@ -98,7 +97,12 @@ class ConstExprParser
return $this->parseArray($tokens, Lexer::TOKEN_CLOSE_SQUARE_BRACKET);
}
throw new LogicException($tokens->currentTokenValue());
throw new ParserException(
$tokens->currentTokenValue(),
$tokens->currentTokenType(),
$tokens->currentTokenOffset(),
Lexer::TOKEN_IDENTIFIER
);
}