Conversation
See #30 (comment) by @ausi why this wouldn't work 😊 |
|
wouldn't that add the argument to any method call as the last, regardless of the number of existing parameters? |
Yes. Do you want us to modify it in a way to allow passing the position? (Unsure if named arguments should be part as well, might be overkill). Hence why I asked for an example. This one would work with the given one but there may be more. |
|
The previous version would have just added arguments on any run (thanks @aschempp for pointing that out, just out of habit, add a rule, refactor, remove the rule 🐒). fb82b31 changes this to consider the array key, also allows a string as the array key to allow replacing / or adding named parameters. The updated tests should explain the behavior. |
|
If I understand the code correctly, this would now always override the argument at the given position, correct? In case of Is that currently possible somehow? Maybe a fourth |
We did agree on adding a fourth argument with |
Description
Similar to the
replaceNestedArrayItemRector, this allows you to simply configure all arguments that you would want within a static method call. We could open it up for other node types than just of typeStaticCallbut that's not necessary right now.Or should we open it for MethodCall and ClassMethod as well 👀 ?
Edit
This one would have just added arguments on any run, fb82b31 changes this to apply a key to the array values, also allows a string as the array key to allow replacing / or adding named parameters.
The updated tests should explain the behavior