wernerkrauss / silverstripe-rector

A developer utility for automatically upgrading deprecated code for Silverstripe CMS
MIT License
5 stars 3 forks source link

useful rector rules? #5

Open sunnysideup opened 1 year ago

sunnysideup commented 1 year ago

Our rector rules (outdated!)

https://github.com/sunnysideup/silverstripe-easy-coding-standards/blob/master/rector.php

SS3 - SS4:

tasks

https://github.com/sunnysideup/silverstripe-upgrade_to_silverstripe_4/tree/master/src/Tasks/IndividualTasks

steps

https://github.com/sunnysideup/silverstripe-upgrade_to_silverstripe_4/blob/master/src/UpgradeRecipes/Ss3ToSs4.php

replacements

https://github.com/sunnysideup/silverstripe-upgrade_to_silverstripe_4/blob/master/ReplacementData/SS4/.upgrade.replacements.yml

sunnysideup commented 1 year ago

If you like I can show you how I use these tools. It would be good to work together.

wernerkrauss commented 1 year ago

HI @sunnysideup of course collaboration is good. Did you also configure deprecation replacements using rector? How does your "replacements" config work?

I'd like to configure as much as possible in Rector (from SS4 on). I created SilverstripeSetLists and SilverstripeLevelSetLists for each minor release since 4.0 and plan to fill them by time.

See also the new docs for an explanation of the project specific rector rules.

sunnysideup commented 8 months ago

Sorry, it has taken me almost a year to respond!

Replacements are just straight replacements.

        "SS_Log::":
            R: "SS_Log::"
            C: "SS_Log: Replaced with a PSR-3 logger (https://docs.silverstripe.org/en/4/changelogs/4.0.0#psr3-logging)"

Searches for SS_Log and replaces it with R (in this case the same). It also adds a comment if it is not a straight replacement from A to B.

I guess I'd love to use this tool and contribute to it.