Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use PHPStan\PhpDocParser\Parser\PhpDocParser;
use PHPStan\PhpDocParser\Parser\TokenIterator;
use PHPStan\PhpDocParser\Parser\TypeParser;
use PHPStan\PhpDocParser\ParserConfig;
use Symfony\Component\PropertyInfo\Extractor\ConstructorArgumentTypeExtractorInterface;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
Expand Down Expand Up @@ -77,8 +78,18 @@ public function __construct(?array $mutatorPrefixes = null, ?array $accessorPref
$this->accessorPrefixes = $accessorPrefixes ?? ReflectionExtractor::$defaultAccessorPrefixes;
$this->arrayMutatorPrefixes = $arrayMutatorPrefixes ?? ReflectionExtractor::$defaultArrayMutatorPrefixes;

$this->phpDocParser = new PhpDocParser(new TypeParser(new ConstExprParser()), new ConstExprParser());
$this->lexer = new Lexer();
if (class_exists(ParserConfig::class)) { // PhpStan 2.0
$config = new ParserConfig([]);
$this->lexer = new Lexer($config);
$this->phpDocParser = new PhpDocParser(
$config,
new TypeParser($config, new ConstExprParser($config)),
new ConstExprParser($config)
);
} else {
$this->lexer = new Lexer();
$this->phpDocParser = new PhpDocParser(new TypeParser(new ConstExprParser()), new ConstExprParser());
}
$this->nameScopeFactory = new NameScopeFactory();
}

Expand Down
4 changes: 2 additions & 2 deletions src/RestClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ public static function create(PsrHttpClient $client, ?string $apiKey = null, ?st
$typeExtractors = [];

/* @infection-ignore-all */
if (isOldPackage('symfony/property-info', '6.1')) {
if (isOldPackage('symfony/property-info', '7.1.8')) {
$typeExtractors[] = new PollyfillPhpStanExtractor();
}

/* @infection-ignore-all */
if (!isOldPackage('symfony/property-info', '6.1')) {
if (!isOldPackage('symfony/property-info', '7.1.8')) {
$typeExtractors[] = new PhpStanExtractor();
}

Expand Down
Loading