|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use Rector\CodeQuality\Rector\FuncCall\RemoveSoleValueSprintfRector; |
| 6 | +use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector; |
| 7 | +use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector; |
| 8 | +use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; |
| 9 | +use Rector\Config\RectorConfig; |
| 10 | +use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector; |
| 11 | +use Rector\DeadCode\Rector\Cast\RecastingRemovalRector; |
| 12 | +use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector; |
| 13 | +use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector; |
| 14 | +use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector; |
| 15 | +use Rector\DeadCode\Rector\If_\ReduceAlwaysFalseIfOrRector; |
| 16 | +use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector; |
| 17 | +use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector; |
| 18 | +use Rector\DeadCode\Rector\Property\RemoveUselessReadOnlyTagRector; |
| 19 | +use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector; |
| 20 | +use Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector; |
| 21 | +use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector; |
| 22 | +use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector; |
| 23 | +use Rector\Php80\Rector\FuncCall\ClassOnObjectRector; |
| 24 | +use Rector\Php80\Rector\Identical\StrEndsWithRector; |
| 25 | +use Rector\Php80\Rector\Identical\StrStartsWithRector; |
| 26 | +use Rector\Php80\Rector\NotIdentical\StrContainsRector; |
| 27 | +use Rector\Php81\Rector\Array_\FirstClassCallableRector; |
| 28 | +use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; |
| 29 | +use Rector\Php82\Rector\Class_\ReadOnlyClassRector; |
| 30 | +use Rector\Php83\Rector\ClassConst\AddTypeToConstRector; |
| 31 | +use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector; |
| 32 | +use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector; |
| 33 | +use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; |
| 34 | + |
| 35 | +$config = RectorConfig::configure() |
| 36 | + ->withCache(__DIR__ . '/var/rector') |
| 37 | + ->withPaths([ |
| 38 | + __DIR__ . '/src', |
| 39 | + ]) |
| 40 | + ->withParallel() |
| 41 | + ->withRules([ |
| 42 | + // Misc |
| 43 | + PrivatizeFinalClassPropertyRector::class, |
| 44 | + PrivatizeFinalClassMethodRector::class, |
| 45 | + UnwrapSprintfOneArgumentRector::class, |
| 46 | + RemoveSoleValueSprintfRector::class, |
| 47 | + CountArrayToEmptyArrayComparisonRector::class, |
| 48 | + // See withConfiguredRule below for more |
| 49 | + |
| 50 | + // Misc - Deadcode |
| 51 | + RemoveUnusedForeachKeyRector::class, |
| 52 | + RemoveDuplicatedArrayKeyRector::class, |
| 53 | + RecastingRemovalRector::class, |
| 54 | + RemoveUnusedNonEmptyArrayBeforeForeachRector::class, |
| 55 | + TernaryToBooleanOrFalseToBooleanAndRector::class, |
| 56 | + RemoveUselessParamTagRector::class, |
| 57 | + RemoveUselessReturnTagRector::class, |
| 58 | + RemoveUselessReadOnlyTagRector::class, |
| 59 | + RemoveNonExistingVarAnnotationRector::class, |
| 60 | + RemoveUselessVarTagRector::class, |
| 61 | + ReduceAlwaysFalseIfOrRector::class, |
| 62 | + |
| 63 | + // PHP 8.0 |
| 64 | + ClassOnThisVariableObjectRector::class, |
| 65 | + ClassOnObjectRector::class, |
| 66 | + StrStartsWithRector::class, |
| 67 | + StrEndsWithRector::class, |
| 68 | + StrContainsRector::class, |
| 69 | + RemoveUnusedVariableInCatchRector::class, |
| 70 | + |
| 71 | + // PHP 8.1 |
| 72 | + ReadOnlyPropertyRector::class, |
| 73 | + FirstClassCallableRector::class, |
| 74 | + |
| 75 | + // PHP 8.2 |
| 76 | + ReadOnlyClassRector::class, |
| 77 | + |
| 78 | + // PHP 8.3 |
| 79 | + AddTypeToConstRector::class, |
| 80 | + AddOverrideAttributeToOverriddenMethodsRector::class, |
| 81 | + ]) |
| 82 | + ->withConfiguredRule(SimplifyUselessVariableRector::class, [ |
| 83 | + SimplifyUselessVariableRector::ONLY_DIRECT_ASSIGN => true, |
| 84 | + ]); |
| 85 | + |
| 86 | +return $config; |
0 commit comments