creating a compound custom rule that modifies multiple nodes at a time #9059
Unanswered
terrafrost
asked this question in
Q&A
Replies: 1 comment
-
Hi, you can do this even with single node. Hook into Check core rules that work with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Say I had this piece of code:
What kind of custom rule - if any - could convert that to this?:
Like I could probably get the
refactor
method to recognize when to do the change by making it so that each successive call to that method modifies a class variable boolean and that after x successive calls if that class variable boolean is still true then we know it's a match. But just as therefactor
method only accepts a single Node as a parameter it also only returns a single Node. So like I could change the name ofloadKey
toload
but I could also change the constructor on the previous line it's unclear to me how I'd do that.Any ideas? Or is what I'm trying to do just not possible with Rector?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions