Need Help - Custom Rules based on Rector 1 - How to get working in Rector 2 #9010
-
I have been maintaining code that uses Rector to help Joomla! developers update their custom components from Joomla! 3 to the new coding structure used in Joomla! 4 + 5, my fork can be found here: https://github.com/mfleeson/joomla_com_upgrader |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The rule needs implements see example rule for configured rule https://github.com/rectorphp/rector-src/blob/59d4bca60c0cc1efb8061524e0425454cb432bc8/rules/Renaming/Rector/FuncCall/RenameFunctionRector.php#L20 and configuration for it https://github.com/rectorphp/rector-src/blob/59d4bca60c0cc1efb8061524e0425454cb432bc8/rules-tests/Renaming/Rector/FuncCall/RenameFunctionRector/config/configured_rule.php#L10 |
Beta Was this translation helpful? Give feedback.
The rule needs implements
\Rector\Contract\Rector\ConfigurableRectorInterface
then, register it with RectorConfig,see example rule for configured rule https://github.com/rectorphp/rector-src/blob/59d4bca60c0cc1efb8061524e0425454cb432bc8/rules/Renaming/Rector/FuncCall/RenameFunctionRector.php#L20
and configuration for it https://github.com/rectorphp/rector-src/blob/59d4bca60c0cc1efb8061524e0425454cb432bc8/rules-tests/Renaming/Rector/FuncCall/RenameFunctionRector/config/configured_rule.php#L10