Skip to content

Instantly share code, notes, and snippets.

@mrLexx
Forked from vudaltsov/happy_rector.php
Created October 19, 2022 10:29
Show Gist options
  • Save mrLexx/bb9dd490cda4efb13d95cc60cd4a1f3c to your computer and use it in GitHub Desktop.
Save mrLexx/bb9dd490cda4efb13d95cc60cd4a1f3c to your computer and use it in GitHub Desktop.
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
use Rector\Php80\Rector\FunctionLike\UnionTypesRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->parallel();
$rectorConfig->cacheDirectory(__DIR__.'/var/rector');
$rectorConfig->paths([
__DIR__.'/migrations',
__DIR__.'/src',
__DIR__.'/src-dev',
__DIR__.'/tests',
]);
$rectorConfig->sets([LevelSetList::UP_TO_PHP_81]);
$rectorConfig->ruleWithConfiguration(RenameFunctionRector::class, [
'json_encode' => 'jsonEncode',
'json_decode' => 'jsonDecode',
]);
$rectorConfig->skip([
ClassPropertyAssignToConstructorPromotionRector::class => [__DIR__.'/src/Http'],
CountOnNullRector::class,
NullToStrictStringFuncCallArgRector::class,
RemoveExtraParametersRector::class,
ReturnNeverTypeRector::class,
StringableForToStringRector::class,
UnionTypesRector::class,
StringClassNameToClassConstantRector::class => [__DIR__.'/migrations'],
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment