Closed dxvargas closed 9 months ago
You are correct. The parser task hasn't been tested against version 5 of nikic's phpparser so it probably won't work out of the box without it getting additional love.
I'm a bit in doubt about deprecating the task though: with static analysis tools like psalm and phpstan, there are better options for doing the same checks - without us having to maintain this inside grumphp's repo.
Another option could be to extract the logic into a new minimalistic analysis tool that can be maintained in that separate repository.
All feedback is welcome so that we can make valid decisions regarding the parser task. In the meantime, I accept PRs that make grumphp compatible with V5.
The composer dependency for
nikic/php-parser
is only a dev dependency and it's set now to "^4.13" Now this package has a new version 5.This version 5 is not using PREFER_PHP7 anymore as stated in the upgrade docs.
The current code in grumphp is using the code in
nikic/php-parse
. See here: https://github.com/phpro/grumphp/blob/v2.4.0/src/Parser/Php/Factory/ParserFactory.phpNow running grumphp results in this error:
So, the ParserFactory here needs changes to work with
nikic/php-parse
version 5.I'm not sure but I'm considering it a bug because the dependency for
nikic/php-parse
allows the usage of version 5 but it doesn't work. If it was not a dev dependecy, we wouldn't have errors, because it's set to version 4 there.