Skip to content

Commit 3b807eb

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: fix support for phpstan/phpdoc-parser 2
2 parents 7d0f22f + 05ab010 commit 3b807eb

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"php-http/httplug": "^1.0|^2.0",
150150
"php-http/message-factory": "^1.0",
151151
"phpdocumentor/reflection-docblock": "^5.2",
152-
"phpstan/phpdoc-parser": "^1.0",
152+
"phpstan/phpdoc-parser": "^1.0|^2.0",
153153
"predis/predis": "^1.1|^2.0",
154154
"psr/http-client": "^1.0",
155155
"psr/simple-cache": "^1.0|^2.0|^3.0",

src/Symfony/Component/PropertyInfo/Extractor/PhpStanExtractor.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use PHPStan\PhpDocParser\Parser\PhpDocParser;
2222
use PHPStan\PhpDocParser\Parser\TokenIterator;
2323
use PHPStan\PhpDocParser\Parser\TypeParser;
24+
use PHPStan\PhpDocParser\ParserConfig;
2425
use Symfony\Component\PropertyInfo\PhpStan\NameScopeFactory;
2526
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
2627
use Symfony\Component\PropertyInfo\Type;
@@ -68,8 +69,14 @@ public function __construct(?array $mutatorPrefixes = null, ?array $accessorPref
6869
$this->accessorPrefixes = $accessorPrefixes ?? ReflectionExtractor::$defaultAccessorPrefixes;
6970
$this->arrayMutatorPrefixes = $arrayMutatorPrefixes ?? ReflectionExtractor::$defaultArrayMutatorPrefixes;
7071

71-
$this->phpDocParser = new PhpDocParser(new TypeParser(new ConstExprParser()), new ConstExprParser());
72-
$this->lexer = new Lexer();
72+
if (class_exists(ParserConfig::class)) {
73+
$parserConfig = new ParserConfig([]);
74+
$this->phpDocParser = new PhpDocParser($parserConfig, new TypeParser($parserConfig, new ConstExprParser($parserConfig)), new ConstExprParser($parserConfig));
75+
$this->lexer = new Lexer($parserConfig);
76+
} else {
77+
$this->phpDocParser = new PhpDocParser(new TypeParser(new ConstExprParser()), new ConstExprParser());
78+
$this->lexer = new Lexer();
79+
}
7380
$this->nameScopeFactory = new NameScopeFactory();
7481
}
7582

src/Symfony/Component/PropertyInfo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"symfony/cache": "^5.4|^6.0|^7.0",
3232
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
3333
"phpdocumentor/reflection-docblock": "^5.2",
34-
"phpstan/phpdoc-parser": "^1.0"
34+
"phpstan/phpdoc-parser": "^1.0|^2.0"
3535
},
3636
"conflict": {
3737
"phpdocumentor/reflection-docblock": "<5.2",

0 commit comments

Comments
 (0)