|
11 | 11 | * the LICENSE file that was distributed with this source code.
|
12 | 12 | */
|
13 | 13 |
|
| 14 | +use Rector\Caching\ValueObject\Storage\FileCacheStorage; |
14 | 15 | use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
|
15 | 16 | use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
|
| 17 | +use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector; |
16 | 18 | use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
|
17 | 19 | use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
|
18 | 20 | use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
|
19 | 21 | use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
|
20 | 22 | use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector;
|
| 23 | +use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector; |
21 | 24 | use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
|
22 | 25 | use Rector\CodeQuality\Rector\If_\CombineIfRector;
|
| 26 | +use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector; |
23 | 27 | use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
|
24 | 28 | use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
|
25 | 29 | use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
|
| 30 | +use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector; |
26 | 31 | use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
|
27 | 32 | use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
|
28 | 33 | use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
|
29 | 34 | use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
|
| 35 | +use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector; |
30 | 36 | use Rector\Config\RectorConfig;
|
31 | 37 | use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
|
32 | 38 | use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
|
|
38 | 44 | use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
|
39 | 45 | use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
40 | 46 | use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
|
| 47 | +use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; |
41 | 48 | use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
|
42 | 49 | use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
|
43 | 50 | use Rector\PHPUnit\Set\PHPUnitSetList;
|
44 | 51 | use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
|
45 | 52 | use Rector\Set\ValueObject\LevelSetList;
|
46 | 53 | use Rector\Set\ValueObject\SetList;
|
| 54 | +use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector; |
| 55 | +use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector; |
| 56 | +use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector; |
47 | 57 | use Rector\ValueObject\PhpVersion;
|
48 | 58 |
|
49 | 59 | return static function (RectorConfig $rectorConfig): void {
|
|
56 | 66 |
|
57 | 67 | $rectorConfig->parallel();
|
58 | 68 |
|
| 69 | + // Github action cache |
| 70 | + $rectorConfig->cacheClass(FileCacheStorage::class); |
| 71 | + if (is_dir('/tmp')) { |
| 72 | + $rectorConfig->cacheDirectory('/tmp/rector'); |
| 73 | + } |
| 74 | + |
59 | 75 | // The paths to refactor (can also be supplied with CLI arguments)
|
60 | 76 | $rectorConfig->paths([
|
61 | 77 | __DIR__ . '/src/',
|
|
89 | 105 | __DIR__ . '/src/Views',
|
90 | 106 |
|
91 | 107 | JsonThrowOnErrorRector::class,
|
| 108 | + StringifyStrNeedlesRector::class, |
92 | 109 | YieldDataProviderRector::class,
|
93 | 110 |
|
94 | 111 | // Note: requires php 8
|
|
140 | 157 | $rectorConfig->rule(FuncGetArgsToVariadicParamRector::class);
|
141 | 158 | $rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
|
142 | 159 | $rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
|
| 160 | + $rectorConfig->rule(SimplifyEmptyCheckOnEmptyArrayRector::class); |
| 161 | + $rectorConfig->rule(TernaryEmptyArrayArrayDimFetchToCoalesceRector::class); |
| 162 | + $rectorConfig->rule(EmptyOnNullableObjectToInstanceOfRector::class); |
| 163 | + $rectorConfig->rule(DisallowedEmptyRuleFixerRector::class); |
143 | 164 | $rectorConfig->rule(StringClassNameToClassConstantRector::class);
|
144 | 165 | $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
|
145 | 166 | $rectorConfig->rule(CompleteDynamicPropertiesRector::class);
|
| 167 | + $rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class); |
| 168 | + $rectorConfig->rule(SingleInArrayToCompareRector::class); |
| 169 | + $rectorConfig->rule(VersionCompareFuncCallToConstantRector::class); |
| 170 | + $rectorConfig->rule(ExplicitBoolCompareRector::class); |
146 | 171 | };
|
0 commit comments