-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
How can I get the constructor args from a New_? #6001
Comments
Hi, we have a repository dedicated to node overview, that is exactly for these questions :) Here, see |
Thanks @TomasVotruba ... it just occurred to me that I could use normal php reflection to get the parameters of the constructor... does that sound like the way to go? |
👍 Reflection can be used too. We're not using native PHP reflection, but static reflections based on better-reflection package: #5665 |
rectorphp/rector-src@93bccca Fix message handler removal in RemoveUnusedPublicMethodParameterRector (#6001)
I'm using
\Rector\Transform\Rector\StaticCall\StaticCallToMethodCallRector
which adds a parameter to the class constructor. I was thinking I'd need to write a new Rector to add the new parameter in unit tests where the class would be constructed by hand. My first attempt was to look through allNode\Expr\New_
but I can't figure out how to get and look at the signature of the constructor to see if I need to modify anything. Is that a good way to go about solving adding the parameter or is there a better way?The text was updated successfully, but these errors were encountered: