You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try with RenameClassRector + RenamePropertyRector and RenamePropertyToMatchTypeRector but none off the possible combinaisons allow me to do it faster than manually.
My problem with RenamePropertyToMatchTypeRector, is that this rector impact others files of the src folder, and there is thousands of files that i can't exclude. There is no possibility to specify a folder or files to work with, except passing by $rectorConfig->paths.
And the RenamePropertyRector requires me to specify all of the thousands of file that I would to change.
I thought about a chain mecanism, for example where RenamePropertyToMatchTypeRector only apply on files modified by RenameClassRector. Same thing to change the property name after the type has been changed, to not specify each file manually. But I don't know if it's achievable with a custom rector.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello !
Is there a way to achieve this refactoring easily with Rector ?
I try with
RenameClassRector
+RenamePropertyRector
andRenamePropertyToMatchTypeRector
but none off the possible combinaisons allow me to do it faster than manually.My problem with
RenamePropertyToMatchTypeRector
, is that this rector impact others files of the src folder, and there is thousands of files that i can't exclude. There is no possibility to specify a folder or files to work with, except passing by $rectorConfig->paths.And the
RenamePropertyRector
requires me to specify all of the thousands of file that I would to change.I thought about a chain mecanism, for example where
RenamePropertyToMatchTypeRector
only apply on files modified byRenameClassRector
. Same thing to change the property name after the type has been changed, to not specify each file manually. But I don't know if it's achievable with a custom rector.When you have a common interface the problem is simpler to resolve https://github.com/rectorphp/rector-symfony/blob/main/config/sets/symfony/symfony52.php#L167-173
Did someone already had to manage this in PHP 7.4 or with promoted property in constructor ?
Thank you 😊
Beta Was this translation helpful? Give feedback.
All reactions