Skip to content

Commit

Permalink
Vendor: support Nikic\PhpParser v5
Browse files Browse the repository at this point in the history
  • Loading branch information
forrest79 committed Mar 12, 2024
1 parent 1027d72 commit de95319
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": "^8.1",
"phpstan/phpstan": "^1.10",
"nikic/php-parser": "^4.17"
"nikic/php-parser": "^5.0"
},
"require-dev": {
"forrest79/phpcs": "^1.5",
Expand All @@ -33,7 +33,7 @@
},
"scripts": {
"phpcs": "vendor/bin/phpcs --bootstrap=vendor/forrest79/phpcs-ignores/src/bootstrap.php -s src tests",
"phpstan": "vendor/bin/phpstan analyse src tests",
"phpstan": "vendor/bin/phpstan analyse src tests -v",
"tests": "php tests/run-tests.php"
},
"config": {
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ includes:

parameters:
level: max
excludePaths:
analyse:
- %rootDir%/../../../tests/Tests.php # temporary PHPStan Nikic\PhpParser version mismatch
ignoreErrors:
-
message: '#^Call to static method Forrest79\\NarrowTypes::isType\(\) with mixed and string will always evaluate to true\.$#'
Expand Down
2 changes: 1 addition & 1 deletion src/NarrowTypes/FullyQualifiedClassNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private static function createNameContext(string|NULL $filename): PhpParser\Name
return NULL;
}

$parser = (new PhpParser\ParserFactory())->create(PhpParser\ParserFactory::PREFER_PHP7);
$parser = (new PhpParser\ParserFactory())->createForVersion(PhpParser\PhpVersion::fromComponents(8, 1));
$traverser = new PhpParser\NodeTraverser();
$nameResolver = new PhpParser\NodeVisitor\NameResolver();
$traverser->addVisitor($nameResolver);
Expand Down

0 comments on commit de95319

Please sign in to comment.