-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update nikic/php-parser to 5.0 #10567
Conversation
I've marked this as ready for review. I still have some doubts about the way I've solved a few of these issues, but am hopeful that feedback will help ensure that the best solution is the one that gets merged. I've incorporated several changes upstream in the |
@@ -33,15 +33,12 @@ | |||
"felixfbecker/language-server-protocol": "^1.5.2", | |||
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0", | |||
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", | |||
"nikic/php-parser": "^4.16", | |||
"nikic/php-parser": "^5.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a dependency that Psalm shares with other tools like PHPUnit. In order to allow downstream projects to upgrade their dependencies gracefully, Psalm should produce a release first that is compatible with both major versions.
"nikic/php-parser": "^5.0.0", | |
"nikic/php-parser": "^4.18 || ^5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to trying to create a version of this PR that would land on the 5.x
branch that would work with both parser v4 and v5. I think the main thing would be going back to the deprecated node names (eg Encapsed
vs Interpolated
), which are still supported in v5 via class aliases.
The thing I'd worry about is additional complexity, maintenance, and testing involved in supporting two versions. The differences are non-trivial, as evidenced by this PR. PHPStan also looks like it's planning to jump to parser v5 on its 2.0 release, with its 1.x releases only supporting parser v4.
I'd like feedback from the maintainers before making any major changes to this PR or creating a new one.
Thank you for this PR. If you would want to provide a second PR to 5.x to support both v4 and v5, that would of course be appreciated, but personally I don't think dropping v4 support for Psalm v6 is that big of a deal (regardless, I would absolutely merge a PR adding support for it). |
@danog it appears it broke psalm.dev sandbox. All snippets return
|
Fixed now. |
Will this be merged into |
I don't have any plans to backport this to 5.x, personally. |
@edsrzf with no rush and no pressure, may I ask you if there's an expected release date for |
I'm not a maintainer, so it's not up to me, but I started a discussion here: #10701 |
I tried to work on the Back port of this PR on 5.x. I just have one error to fix, any help is welcomed. |
PR on 5.x is ready #11035 open to review or tests on real project :) |
I saw #10562, and I've also been playing around with this.
The main issues I encountered in this update were:
PhpParser\Node\Stmt\Throw
. Throws are now always treated as expressions.ReflectorVisitor
, so very open to suggestions.