mxr576 / rector-drupal-configurator
Configures Rector to understand a Drupal 8+ codebase.
Requires
- php: ^7.4.0 || ~8.0.0 || ~8.1.0
- mglaman/drupal-static-autoloader: ~0.1.0
- rector/rector: ~0.13.7
- webflo/drupal-finder: ^1.2
README
Provides utility for configuring Rector to understand a Drupal 8+ codebase.
Usage
$ composer require mxr576/rector-drupal-configurator
$ ./vendor/bin/rector init
and call
$drc = new \mxr576\RectorDrupalConfigurator\RectorDrupalConfigurator(); $drc->configure($rectorConfig);
at the beginning of the generated function in rector.php
. See example.rector.php.
What is a difference between this library and palantirnet/drupal-rector
?
palantirnet/drupal-rector not just configures Rector to understand a
Drupal 8+ codebase but also includes (only) Drupal specific Rector rules in the rector.php
that it provides.
This library decouples the "Drupal configuration" part and (only) provides a standalone solution that configures Rector
to understand a Drupal 8+ codebase in any rector.php
. What other Rector configurations (e.g.: rules) you enable in
that rector.php it is up to you. See example.rector.php.
In addition, this solution uses Matt Glaman's awesome mglaman/drupal-static-autoloader
to cast all magic that is needed to autoload every necessary Drupal files.
TODOs
- Add test coverage
- Add code-quality checks and linters
Credits
- Thanks Pronovix for sponsoring the initial development
- Kudos to all developers that this small library depends on