paths( $paths ); // ignore various test cases $rectorConfig->skip( [ __DIR__ . '/src/__tests__', __DIR__ . '/src/*/__tests__', ] ); // trying to set the current (and minimum) PHP version to be adopted as base // https://getrector.com/documentation/php-version-features // https://we.phorge.it/book/phorge/article/installation_guide/ $rectorConfig->phpVersion(PhpVersion::PHP_55); // just the refactors we want $rectorConfig->sets( [ // trying to add support to this PHP version and below (PHP 8.2) Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_82, // Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector::class, // Rector\Php53\Rector\Ternary\TernaryToElvisRector::class, // Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector::class, ] ); // trying to respect obsolete Phorge's code styles previous to PHP 5.5 $rectorConfig->skip([ // for some reasons we want long "array()" instead of "[]"... // https://we.phorge.it/book/contrib/article/php_coding_standards/ Rector\Php54\Rector\Array_\LongArrayToShortArrayRector::class, // avoid to add the PHPDOC "* @return never" since it can be confusing Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector::class, ]); // tried to drop the () function that just returns the first argument // so I tried just renaming this function to an empty space // so it should do // - id( new Asd() ) // + ( new Asd() ) // but this is not supported in Rector since it throws an exception // $rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [ // 'id' => '', // ]); // So it was implemented in this way: // find . -name "*.php" ! -name rector.php -exec sed -E -i 's/([ =.+,-\)])id\(/\1(/g' {} + // trying to don't destroy my computer that does not have 16 cores but 12 // defaults: // time: 120 // cores: 16 // jobSize: 20 // https://getrector.com/documentation/troubleshooting-parallel $rectorConfig->parallel( 120, 12, 20 ); };