diff --git a/composer.json b/composer.json index a4994c5b..d00a6480 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "nikic/php-parser": "~5", "webmozart/assert": "^1.9", "ext-json": "*", - "phpstan/phpdoc-parser": "^1.2", + "phpstan/phpdoc-parser": "^2.0", "ondram/ci-detector": "^4.1" }, "require-dev": { diff --git a/src/Analyzer/NameResolver.php b/src/Analyzer/NameResolver.php index 82d023cb..8bb306c8 100644 --- a/src/Analyzer/NameResolver.php +++ b/src/Analyzer/NameResolver.php @@ -23,6 +23,7 @@ use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use PHPStan\PhpDocParser\Parser\TypeParser; +use PHPStan\PhpDocParser\ParserConfig; class NameResolver extends NodeVisitorAbstract { @@ -65,10 +66,11 @@ public function __construct(?ErrorHandler $errorHandler = null, array $options = $this->replaceNodes = $options['replaceNodes'] ?? true; $this->parseCustomAnnotations = $options['parseCustomAnnotations'] ?? true; - $typeParser = new TypeParser(); - $constExprParser = new ConstExprParser(); - $this->phpDocParser = new PhpDocParser($typeParser, $constExprParser); - $this->phpDocLexer = new Lexer(); + $parserConfig = new ParserConfig([]); + $constExprParser = new ConstExprParser($parserConfig); + $typeParser = new TypeParser($parserConfig, $constExprParser); + $this->phpDocParser = new PhpDocParser($parserConfig, $typeParser, $constExprParser); + $this->phpDocLexer = new Lexer($parserConfig); } /**