rector - taka512/memo GitHub Wiki

コード補正ツール

ドキュメント

https://github.com/rectorphp/rector

実行例

vendor/bin/rector process --dry-run src/Controller 

コンフィグ指定

vendor/bin/rector process --dry-run --config hoge.php

設定例

<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Caching\ValueObject\Storage\FileCacheStorage;

return static function (RectorConfig $config) {
    $config->paths([
        __DIR__ . '/src/Controller',

    ]);

    // define sets of rules
    $config->sets([
        SetList::PHP_74,
        SetList::PSR_4,
        LevelSetList::UP_TO_PHP_74,
    ]);

    $config->importNames();
    $config->parallel(360);

    $config->cacheClass(FileCacheStorage::class);
    $config->cacheDirectory('./tmp/cache/hoge');
};