Skip to content

Commit

Permalink
fix support for phpstan/phpdoc-parser 2
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Nov 12, 2024
1 parent 17c916c commit 2fb3557
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use PHPStan\PhpDocParser\Parser\PhpDocParser;
use PHPStan\PhpDocParser\Parser\TokenIterator;
use PHPStan\PhpDocParser\Parser\TypeParser;
use PHPStan\PhpDocParser\ParserConfig;

/**
* Extracts descriptions from PHPDoc.
Expand Down Expand Up @@ -58,7 +59,11 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn
}
$phpDocParser = null;
$lexer = null;
if (class_exists(PhpDocParser::class)) {
if (class_exists(PhpDocParser::class) && class_exists(ParserConfig::class)) {
$config = new ParserConfig([]);
$phpDocParser = new PhpDocParser($config, new TypeParser($config, new ConstExprParser($config)), new ConstExprParser($config));

Check failure on line 64 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #1 $constExprParser of class PHPStan\PhpDocParser\Parser\TypeParser constructor expects PHPStan\PhpDocParser\Parser\ConstExprParser|null, PHPStan\PhpDocParser\ParserConfig given.

Check failure on line 64 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #1 $typeParser of class PHPStan\PhpDocParser\Parser\PhpDocParser constructor expects PHPStan\PhpDocParser\Parser\TypeParser, PHPStan\PhpDocParser\ParserConfig given.

Check failure on line 64 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #1 $unescapeStrings of class PHPStan\PhpDocParser\Parser\ConstExprParser constructor expects bool, PHPStan\PhpDocParser\ParserConfig given.

Check failure on line 64 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #1 $unescapeStrings of class PHPStan\PhpDocParser\Parser\ConstExprParser constructor expects bool, PHPStan\PhpDocParser\ParserConfig given.

Check failure on line 64 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #2 $constantExprParser of class PHPStan\PhpDocParser\Parser\PhpDocParser constructor expects PHPStan\PhpDocParser\Parser\ConstExprParser, PHPStan\PhpDocParser\Parser\TypeParser given.

Check failure on line 64 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #2 $quoteAwareConstExprString of class PHPStan\PhpDocParser\Parser\TypeParser constructor expects bool, PHPStan\PhpDocParser\Parser\ConstExprParser given.

Check failure on line 64 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #3 $requireWhitespaceBeforeDescription of class PHPStan\PhpDocParser\Parser\PhpDocParser constructor expects bool, PHPStan\PhpDocParser\Parser\ConstExprParser given.
$lexer = new Lexer($config);

Check failure on line 65 in src/Metadata/Resource/Factory/PhpDocResourceMetadataCollectionFactory.php

View workflow job for this annotation

GitHub Actions / PHPStan (PHP 8.3)

Parameter #1 $parseDoctrineAnnotations of class PHPStan\PhpDocParser\Lexer\Lexer constructor expects bool, PHPStan\PhpDocParser\ParserConfig given.
} elseif (class_exists(PhpDocParser::class)) {
$phpDocParser = new PhpDocParser(new TypeParser(new ConstExprParser()), new ConstExprParser());
$lexer = new Lexer();
}
Expand Down

0 comments on commit 2fb3557

Please sign in to comment.