Skip to content

Instantly share code, notes, and snippets.

@divinity76
Created March 4, 2024 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divinity76/29e055ded439ea414e0fb9523e966c3e to your computer and use it in GitHub Desktop.
Save divinity76/29e055ded439ea414e0fb9523e966c3e to your computer and use it in GitHub Desktop.
rector.php example
<?php
declare(strict_types=1);
return (static function (\Rector\Config\RectorConfig $rectorConfig): void {
$rectorConfig->paths([
'/home/hans/projects/php-ml/',
]);
$rectorConfig->sets([
\Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_82,
]);
$rectorConfig->skip([
/* \Rector\Php70\Rector\FuncCall\RandomFunctionRector::class, // the code changes may incur a performance penalty (using random_int() over rand() for example)
\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class, // php<8.0 compatibility
\Rector\Php80\Rector\Class_\StringableForToStringRector::class, // php<8.0 compatibility
\Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector::class, // php<7.3 compatibility ... do we really need PHP<7.3 compatibility?
\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class, // php<8.0 compatibility
\Rector\Php80\Rector\FunctionLike\MixedTypeRector::class, // php<8.0 compatibility
\Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector::class, // personal preference.. and PHP<7.4 compatibility
\Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector::class, // probably had our reasons for naming it differently
\Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector::class, // probably had our reasons for naming it differently
\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class, // seems to be a bug in Rector where cannot find parent methods that actually exists
*/
]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment