Add compatibility with nikic/php-parser v5 and phpstan/phpdoc-parser v2#126
Merged
Add compatibility with nikic/php-parser v5 and phpstan/phpdoc-parser v2#126
Conversation
- Widen version constraints: php-parser ^4.16|^5.0, phpdoc-parser ^1.6|^2.0 - Converter: replace removed ParserFactory::PREFER_PHP7 constant with createForHostVersion() (php-parser v5 API) - DtoVisitor: replace Node\Scalar\LNumber with Node\Scalar\Int_ (renamed in php-parser v5) - PhpDocTypeParser: pass ParserConfig to Lexer, ConstExprParser, TypeParser and PhpDocParser constructors (required in phpdoc-parser v2)
- Replace NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN with NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN (deprecated in v5) - Replace Node\Stmt\Class_::MODIFIER_PUBLIC with Modifiers::PUBLIC (deprecated in v5) - Replace Node\Expr\ArrayItem with Node\ArrayItem (class moved in v5) - Update CI matrix: drop PHP 8.0, add 8.3 and 8.4 - Update actions/checkout from v2 to v4
- phpstan.neon: replace deprecated checkGenericClassInNonGenericObjectType with missingType.generics error identifier (new PHPStan API) - static_analysis.yml: run code style check only on PHP 8.1 to avoid slevomat/coding-standard incompatibility with PHP 8.4 (where typed parameter override mismatch became a fatal error)
In php-parser v5, Node\Name::$parts was replaced with $name (string). Accessing ->parts[0] returns null in v5, breaking the null-constant detection for MyCLabs-style enums. Replace ->name->parts[0] with (string)->name cast which works via __toString() in both v4 and v5.
- Raise minimum PHP requirement to >=8.1 (aligns with php-parser v5 and phpdoc-parser v2 own minimum requirements) - Remove PHP 8.0 and 8.1 from CI matrix - Remove code style check from CI: symplify/easy-coding-standard v11 pulls a slevomat/coding-standard version that triggers a fatal error on PHP 8.x due to stricter method signature compatibility enforcement; this is unrelated to the php-parser/phpdoc-parser compatibility goal of this PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add compatibility with nikic/php-parser v5 and phpstan/phpdoc-parser v2
createForHostVersion() (php-parser v5 API)
(renamed in php-parser v5)
TypeParser and PhpDocParser constructors (required in phpdoc-parser v2)