mxr576/rector-drupal-configurator

Configures Rector to understand a Drupal 8+ codebase.

0.2.0 2022-06-30 11:33 UTC

This package is auto-updated.

Last update: 2024-11-29 06:23:13 UTC


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