Skip to content

Best way to bootstrap + configure Rector programatically? #7026

Answered by TomasVotruba
brandonkelly asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for question. I

There are basically 2 ways.

  1. make use of init command - https://github.com/KnpLabs/DoctrineBehaviors#upgrade-1x-to-2, this is helpful for gradual upgrade and dry run. It's safer to upgrade rule by rule and path by path, so the existing config helps with ignoring files before full upgrade merge

  2. prepare the same config with defined rules, but use --config option to link it:

vendor/bin/rector process src --config vendor/craftcms-rector/config/craftcms-40.php

There will be more versions to upgrade, and people tent to stick with know syntax, so I recommend using the first one and keep the config in CI.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@brandonkelly
Comment options

Answer selected by samsonasik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants