rector/build/target-repository/docs/how_to_configure_rules.md
Tomas Votruba 8d92c466fd
[DX] Use RectorConfig in configs (#2063)
* use RectorConfig in configs

* update variable name

* remove extra spaces

* apply on configs

* apply on e2e

* update markdown files

* remove extra spaces
2022-04-12 13:46:07 +02:00

486 B

How To Configure Rules

Rector rules that implement Rector\Core\Contract\Rector\ConfigurableRectorInterface can be configured.

Typical example is Rector\Renaming\Rector\Name\RenameClassRector:

use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
        'App\SomeOldClass' => 'App\SomeNewClass',
    ]);
};