Automate fixing deprecated Drupal code.
https://www.palantir.net/blog/jumpstart-your-drupal-9-upgrade-drupal-rector
https://www.drupal.org/project/rector
$ composer require --dev palantirnet/drupal-rector
If you have installation issues, you may need to upgrade phpstan/phpstan
with Composer first.
You will need to have a rector.yml
configuration in the root of your repository. This should sit beside your document root such as web
or docroot
.
You can copy the file example rector.yml
file from this repository.
If you are using docroot
as your document root instead of web
, you will need to edit the rector.yml
file from this repository to point to docroot
instead of web
under parameters.autoload_paths
.
parameters:
autoload_paths:
- 'web/core'
- 'web/core/modules'
- 'web/modules'
- 'web/profiles'
- Analyze your code with Rector and review suggested changes:
$ vendor/bin/rector process web/modules/contrib/[YOUR_MODULE] --dry-run
- Apply suggested changes:
$ vendor/bin/rector process web/modules/contrib/[YOUR_MODULE]
You can find more information about Rector here.
We recommend using our drupal-rector-sandbox
development environment https://github.com/palantirnet/drupal-rector-sandbox
Alternatively, you can use your existing Drupal project and follow the instructions in README
Current development is sponsored by Palantir.net.
Initial development is sponsored by Pronovix.