File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1212 "require" : {
1313 "php" : " ^7.3 || ^8.0" ,
1414 "phpdocumentor/reflection-common" : " ^2.0" ,
15- "phpstan/phpdoc-parser" : " ^1.18" ,
15+ "phpstan/phpdoc-parser" : " ^1.18|^2.0 " ,
1616 "doctrine/deprecations" : " ^1.0"
1717 },
1818 "require-dev" : {
Original file line number Diff line number Diff line change 9898use PHPStan \PhpDocParser \Parser \ParserException ;
9999use PHPStan \PhpDocParser \Parser \TokenIterator ;
100100use PHPStan \PhpDocParser \Parser \TypeParser ;
101+ use PHPStan \PhpDocParser \ParserConfig ;
101102use RuntimeException ;
102103
103104use function array_filter ;
@@ -189,8 +190,15 @@ final class TypeResolver
189190 public function __construct (?FqsenResolver $ fqsenResolver = null )
190191 {
191192 $ this ->fqsenResolver = $ fqsenResolver ?: new FqsenResolver ();
192- $ this ->typeParser = new TypeParser (new ConstExprParser ());
193- $ this ->lexer = new Lexer ();
193+
194+ if (class_exists (ParserConfig::class)) {
195+ $ parserConfig = new ParserConfig ([]);
196+ $ this ->typeParser = new TypeParser ($ parserConfig , new ConstExprParser ($ parserConfig ));
197+ $ this ->lexer = new Lexer ($ parserConfig );
198+ } else {
199+ $ this ->typeParser = new TypeParser (new ConstExprParser ());
200+ $ this ->lexer = new Lexer ();
201+ }
194202 }
195203
196204 /**
You can’t perform that action at this time.
0 commit comments