|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +declare(strict_types=1); |
| 4 | + |
3 | 5 | use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector; |
| 6 | +use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; |
4 | 7 | use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector; |
5 | 8 | use Rector\CodeQuality\Rector\For_\ForToForeachRector; |
6 | 9 | use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector; |
|
30 | 33 | use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector; |
31 | 34 | use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; |
32 | 35 | use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; |
33 | | -use Rector\Php74\Rector\Property\TypedPropertyRector; |
| 36 | +use Rector\PHPUnit\Rector\Class_\AnnotationWithValueToAttributeRector; |
34 | 37 | use Rector\PHPUnit\Set\PHPUnitSetList; |
| 38 | +use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; |
35 | 39 | use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector; |
36 | 40 | use Rector\Set\ValueObject\LevelSetList; |
37 | 41 | use Rector\Set\ValueObject\SetList; |
38 | 42 |
|
39 | 43 | return static function (RectorConfig $rectorConfig): void { |
40 | | - $rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitSetList::PHPUNIT_80]); |
| 44 | + $rectorConfig->sets([ |
| 45 | + SetList::DEAD_CODE, |
| 46 | + LevelSetList::UP_TO_PHP_74, |
| 47 | + PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, |
| 48 | + PHPUnitSetList::PHPUNIT_100, |
| 49 | + ]); |
| 50 | + |
41 | 51 | $rectorConfig->parallel(); |
| 52 | + |
42 | 53 | // The paths to refactor (can also be supplied with CLI arguments) |
43 | 54 | $rectorConfig->paths([ |
44 | 55 | __DIR__ . '/src/', |
|
74 | 85 |
|
75 | 86 | // Note: requires php 8 |
76 | 87 | RemoveUnusedPromotedPropertyRector::class, |
| 88 | + AnnotationWithValueToAttributeRector::class, |
77 | 89 |
|
78 | 90 | // Ignore tests that might make calls without a result |
79 | 91 | RemoveEmptyMethodCallRector::class => [ |
|
97 | 109 | __DIR__ . '/src/Models/UserModel.php', |
98 | 110 | ], |
99 | 111 | ]); |
| 112 | + // auto import fully qualified class names |
| 113 | + $rectorConfig->importNames(); |
| 114 | + |
100 | 115 | $rectorConfig->rule(SimplifyUselessVariableRector::class); |
101 | 116 | $rectorConfig->rule(RemoveAlwaysElseRector::class); |
102 | 117 | $rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class); |
|
119 | 134 | $rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class); |
120 | 135 | $rectorConfig->rule(SimplifyEmptyArrayCheckRector::class); |
121 | 136 | $rectorConfig->rule(NormalizeNamespaceByPSR4ComposerAutoloadRector::class); |
122 | | - $rectorConfig |
123 | | - ->ruleWithConfiguration(TypedPropertyRector::class, [ |
124 | | - TypedPropertyRector::INLINE_PUBLIC => false, |
125 | | - ]); |
| 137 | + $rectorConfig->rule(StringClassNameToClassConstantRector::class); |
| 138 | + $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class); |
| 139 | + $rectorConfig->rule(CompleteDynamicPropertiesRector::class); |
126 | 140 | }; |
0 commit comments