-
-
Notifications
You must be signed in to change notification settings - Fork 693
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
PHPStan 1.6.0 with bleedingEdge will remove previous/next/parent node attributes #7088
Comments
Hi Ondra, thanks for heads up 👍
That could be way to go here too. We'll have to investigate each rule if we can modify it that way. Do you have some PRs of such "moving away from parent" in PHPStan rules? We could inspire there.
|
I did all the work in PHPStan itself in this PR: phpstan/phpstan-src#1175 |
@ondrejmirtes |
You don't. You need to write a visitor that gathers the specific data and sets it to attributes. Check my PR. |
I am not sure about specific data, as it can be anything in single upper to be checked after found, or up until very first Node or collections. |
Exactly - you need to write a different visitor for each use case and gather specific data. |
resolved at rectorphp/rector-src#2014 with compatibility config, we may can update to use specific visitor when possible in the future. |
Feature Request
Just to let you know - I'm currently fighting with memory leaks in PHPStan and I have some impressive results. I don't know yet when PHPStan 1.6.0 will be released as there's lot more work to be done, but one thing I know for sure now is that I no longer want to be using
PhpParser\NodeVisitor\NodeConnectingVisitor
.By default nothing will break in PHPStan 1.6.0, but users can opt-in for new and potentially breaking features: https://phpstan.org/blog/what-is-bleeding-edge
So users with bleedingEdge included in their config would probably have broken Rector.
What you can do: the easy fix is to add these lines to Rector's PHPStan config:
But obviously this leaks memory and is very inefficient. What I do instead in PHPStan core is to adapt rules not to use 'parent' node attribute, but instead write different visitors for different scenarios.
Check this PR to see what I mean: phpstan/phpstan-src#1175
There's a bunch of new visitors there: ArrayFilterArgVisitor, ArrayMapArgVisitor, NewAssignedToPropertyVisitor, ParentStmtTypesVisitor, TryCatchTypeVisitor
And the assigned attributes are read in places where
'parent'
was used instead.The text was updated successfully, but these errors were encountered: