Skip to content

Conversation

@NiclasvanEyk
Copy link
Contributor

@NiclasvanEyk NiclasvanEyk commented Feb 14, 2024

5.0 had some breaking changes, but it improves pretty printing and lots of packages in the php ecosystem already support it:

phpunit/php-code-coverage 10.1.11 requires nikic/php-parser (^4.18 || ^5.0) psy/psysh v0.12.0 requires nikic/php-parser (^5.0 || ^4.0) sebastian/complexity 3.2.0 requires nikic/php-parser (^4.18 || ^5.0) sebastian/lines-of-code 2.0.2 requires nikic/php-parser (^4.18 || ^5.0) 

This pr changes the requirements to also allow 5.x versions, while preserving backwards compatibility for lower versions.
On 5.x the new ParserFactory::createForHostVersion() is used to create a parser matching the current PHP version. Older versions use the same code as before using ParserFactory::PREFER_PHP_7.

I tested it using a fresh Laravel installation with nikic/php-parser 4.x and 5.x respectively and both succeeded without any issues.

@NiclasvanEyk NiclasvanEyk marked this pull request as ready for review February 14, 2024 14:41
@mechelon mechelon changed the base branch from master to updates March 15, 2024 16:47
@mechelon mechelon merged commit 7796af7 into beyondcode:updates Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants