|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector; |
| 4 | +use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; |
4 | 5 | use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector; |
5 | 6 | use Rector\CodeQuality\Rector\For_\ForToForeachRector; |
6 | 7 | use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector; |
|
29 | 30 | use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector; |
30 | 31 | use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; |
31 | 32 | use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; |
32 | | -use Rector\Php74\Rector\Property\TypedPropertyRector; |
| 33 | +use Rector\PHPUnit\Rector\Class_\AnnotationWithValueToAttributeRector; |
33 | 34 | use Rector\PHPUnit\Set\PHPUnitSetList; |
| 35 | +use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; |
34 | 36 | use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector; |
35 | 37 | use Rector\Set\ValueObject\LevelSetList; |
36 | 38 | use Rector\Set\ValueObject\SetList; |
37 | 39 |
|
38 | 40 | return static function (RectorConfig $rectorConfig): void { |
39 | | - $rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitSetList::PHPUNIT_80]); |
| 41 | + $rectorConfig->sets([ |
| 42 | + SetList::DEAD_CODE, |
| 43 | + LevelSetList::UP_TO_PHP_74, |
| 44 | + PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, |
| 45 | + PHPUnitSetList::PHPUNIT_100, |
| 46 | + ]); |
| 47 | + |
40 | 48 | $rectorConfig->parallel(); |
| 49 | + |
41 | 50 | // The paths to refactor (can also be supplied with CLI arguments) |
42 | 51 | $rectorConfig->paths([ |
43 | 52 | __DIR__ . '/app/', |
|
73 | 82 |
|
74 | 83 | // Note: requires php 8 |
75 | 84 | RemoveUnusedPromotedPropertyRector::class, |
| 85 | + AnnotationWithValueToAttributeRector::class, |
76 | 86 |
|
77 | 87 | // Ignore tests that might make calls without a result |
78 | 88 | RemoveEmptyMethodCallRector::class => [ |
79 | 89 | __DIR__ . '/tests', |
80 | 90 | ], |
81 | 91 |
|
82 | | - // Ignore files that should not be namespaced |
| 92 | + // Ignore files that should not be namespaced to their folder |
83 | 93 | NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [ |
84 | 94 | __DIR__ . '/app/Helpers', |
85 | 95 | ], |
|
90 | 100 | // May be uninitialized on purpose |
91 | 101 | AddDefaultValueForUndefinedVariableRector::class, |
92 | 102 | ]); |
| 103 | + |
| 104 | + // auto import fully qualified class names |
| 105 | + $rectorConfig->importNames(); |
| 106 | + |
93 | 107 | $rectorConfig->rule(SimplifyUselessVariableRector::class); |
94 | 108 | $rectorConfig->rule(RemoveAlwaysElseRector::class); |
95 | 109 | $rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class); |
|
112 | 126 | $rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class); |
113 | 127 | $rectorConfig->rule(SimplifyEmptyArrayCheckRector::class); |
114 | 128 | $rectorConfig->rule(NormalizeNamespaceByPSR4ComposerAutoloadRector::class); |
115 | | - $rectorConfig |
116 | | - ->ruleWithConfiguration(TypedPropertyRector::class, [ |
117 | | - // Set to false if you use in libraries, or it does create breaking changes. |
118 | | - TypedPropertyRector::INLINE_PUBLIC => false, |
119 | | - ]); |
| 129 | + $rectorConfig->rule(StringClassNameToClassConstantRector::class); |
| 130 | + $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class); |
| 131 | + $rectorConfig->rule(CompleteDynamicPropertiesRector::class); |
120 | 132 | }; |
0 commit comments