Automate fixing deprecated Drupal code.
https://www.palantir.net/blog/jumpstart-your-drupal-9-upgrade-drupal-rector
https://www.drupal.org/project/rector
Install the library inside a drupal project.
$ composer require --dev palantirnet/drupal-rector
Create / copy / symlink a rector.yml
file in the Drupal root.
imports:
- { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8-all-deprecations.yml" }
# includes:
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.5-deprecations.yml" }
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.6-deprecations.yml" }
# - { resource: "vendor/palantirnet/drupal-rector/config/drupal-8/drupal-8.7-deprecations.yml" }
parameters:
autoload_paths:
- 'web/core'
- 'web/core/modules'
- 'web/modules'
- 'web/profiles'
file_extensions:
- module
- theme
- install
- profile
- inc
- engine
services: ~
- 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.