|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; |
| 6 | +use Rector\Config\RectorConfig; |
| 7 | +use Rector\Set\ValueObject\SetList; |
| 8 | +use Rector\Set\ValueObject\LevelSetList; |
| 9 | +use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; |
| 10 | +use Rector\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector; |
| 11 | + |
| 12 | +use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector; |
| 13 | +use Rector\Arguments\Rector\FuncCall\FunctionArgumentDefaultValueReplacerRector; |
| 14 | +use Rector\Arguments\ValueObject\ArgumentAdder; |
| 15 | +use Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue; |
| 16 | +use Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector; |
| 17 | + |
| 18 | +use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector; |
| 19 | +use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector; |
| 20 | +use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; |
| 21 | +use Rector\Php80\Rector\Class_\StringableForToStringRector; |
| 22 | +use Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector; |
| 23 | +use Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector; |
| 24 | +use Rector\Php80\Rector\ClassMethod\SetStateToStaticRector; |
| 25 | +use Rector\Php80\Rector\FuncCall\ClassOnObjectRector; |
| 26 | +use Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector; |
| 27 | +use Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector; |
| 28 | +use Rector\Php80\Rector\FunctionLike\MixedTypeRector; |
| 29 | +use Rector\Php80\Rector\FunctionLike\UnionTypesRector; |
| 30 | +use Rector\Php80\Rector\Identical\StrEndsWithRector; |
| 31 | +use Rector\Php80\Rector\Identical\StrStartsWithRector; |
| 32 | +use Rector\Php80\Rector\NotIdentical\StrContainsRector; |
| 33 | +use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector; |
| 34 | +use Rector\Php80\Rector\Ternary\GetDebugTypeRector; |
| 35 | +use Rector\Renaming\Rector\FuncCall\RenameFunctionRector; |
| 36 | +use Rector\Transform\Rector\StaticCall\StaticCallToFuncCallRector; |
| 37 | +use Rector\Transform\ValueObject\StaticCallToFuncCall; |
| 38 | + |
| 39 | +return static function (RectorConfig $rectorConfig): void { |
| 40 | + |
| 41 | + $rectorConfig->paths([ |
| 42 | + // __DIR__ . '/framework/core' |
| 43 | + // __DIR__ . '/CodeIgniter/Framework/libraries/Upload.php', |
| 44 | + __DIR__ . '/CodeIgniter/Framework/database/DB_query_builder.php', |
| 45 | + // __DIR__ . '/MX/Loader.php', |
| 46 | + // __DIR__ . '/Core/core/Debug/Error.php', |
| 47 | + // __DIR__ . '/Core/core/Debug/Error.php', |
| 48 | + // __DIR__ . '/Core/core/View/Plates.php', |
| 49 | + // __DIR__ . '/Core/core/Console/Console.php', |
| 50 | + // __DIR__ . '/Tests/image_output.php', |
| 51 | + ]); |
| 52 | + |
| 53 | + // define sets of rules |
| 54 | + $rectorConfig->sets([ |
| 55 | + // SetList::CODE_QUALITY, |
| 56 | + // SetList::DEAD_CODE, |
| 57 | + // SetList::CODING_STYLE, |
| 58 | + SetList::TYPE_DECLARATION, |
| 59 | + // SetList::EARLY_RETURN, |
| 60 | + // LevelSetList::UP_TO_PHP_80, |
| 61 | + // LevelSetList::UP_TO_PHP_81, |
| 62 | + // LevelSetList::UP_TO_PHP_82, |
| 63 | + // LevelSetList::UP_TO_PHP_83 |
| 64 | + ]); |
| 65 | + |
| 66 | + $rectorConfig->rule(UnionTypesRector::class); |
| 67 | + $rectorConfig->rule(StrContainsRector::class); |
| 68 | + $rectorConfig->rule(StrStartsWithRector::class); |
| 69 | + $rectorConfig->rule(StrEndsWithRector::class); |
| 70 | + // register a single rule |
| 71 | + $rectorConfig->rule(TypedPropertyFromStrictConstructorRector::class); |
| 72 | + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); |
| 73 | + $rectorConfig->rule(ReturnTypeFromStrictScalarReturnExprRector::class); |
| 74 | +}; |
0 commit comments