In this hands-on tutorial I want to show the whole process of setting up rector, creating the config file, adapting it to needs and finding cases that are not covered by it and how to change that.
has plenty of rules ⇾ PHP’s own migrations (PHP 7.4 to PHP 8) ⇾ PhpUnit Migrations (@test to #[TEST]) ⇾ Doctrine Migrations ⇨ Improve Code Quality & Code style ⇨ Remove dead code ⇨ And lots more… 👉 Import the RuleSets from Rector! 12
applied Rule as a single commit with: github.com/mogic-le/rector-single-commit You need to create the commit message files 👉 Adjust the script and fix the code style after each commit
⇨ GeneralUtilityMakeInstanceToConstructorPro pertyRector ⇨ All Rules in the Docs with: “🔧 configure it!” How do I configure them? 👉 Look in the Docs or Tests! 22
them: // new format: return RectorConfig::configure() ->withConfiguredRule(RenameMethodRector::class, [ new MethodCallRename('Doctrine\\DBAL\\Connection', 'getSchemaManager', 'createSchemaManager'), ]); ⇨ You don’t have to create new rules for each case.
->withSkip([ __DIR__ . ‘/path/to/file/to/skip.ext’, // by file path / directory RuleToSkip::class, // by rule AnotherRuleToSkip::class, [ // by combination __DIR__ . ‘/path/to/file/to/skip.ext’, ], ]); ⇨ Works the same in Fractor