|
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\PHPUnit\Set\PHPUnitLevelSetList; |
33 | 33 | use Rector\PHPUnit\Set\PHPUnitSetList; |
| 34 | +use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector; |
34 | 35 | use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector; |
35 | 36 | use Rector\Set\ValueObject\LevelSetList; |
36 | 37 | use Rector\Set\ValueObject\SetList; |
37 | 38 | use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; |
38 | 39 |
|
39 | 40 | return static function (RectorConfig $rectorConfig): void { |
40 | | - $rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitLevelSetList::UP_TO_PHPUNIT_100]); |
| 41 | + $rectorConfig->sets([ |
| 42 | + SetList::DEAD_CODE, |
| 43 | + LevelSetList::UP_TO_PHP_74, |
| 44 | + PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, |
| 45 | + PHPUnitSetList::PHPUNIT_100, |
| 46 | + ]); |
| 47 | + |
41 | 48 | $rectorConfig->parallel(); |
| 49 | + |
42 | 50 | // The paths to refactor (can also be supplied with CLI arguments) |
43 | 51 | $rectorConfig->paths([ |
44 | 52 | __DIR__ . '/app/', |
|
80 | 88 | __DIR__ . '/tests', |
81 | 89 | ], |
82 | 90 |
|
83 | | - // Ignore files that should not be namespaced |
| 91 | + // Ignore files that should not be namespaced to their folder |
84 | 92 | NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [ |
85 | 93 | __DIR__ . '/app/Helpers', |
86 | 94 | ], |
|
91 | 99 | // May be uninitialized on purpose |
92 | 100 | AddDefaultValueForUndefinedVariableRector::class, |
93 | 101 | ]); |
| 102 | + |
| 103 | + // auto import fully qualified class names |
| 104 | + $rectorConfig->importNames(); |
| 105 | + |
94 | 106 | $rectorConfig->rule(SimplifyUselessVariableRector::class); |
95 | 107 | $rectorConfig->rule(RemoveAlwaysElseRector::class); |
96 | 108 | $rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class); |
|
118 | 130 | // Set to false if you use in libraries, or it does create breaking changes. |
119 | 131 | TypedPropertyFromAssignsRector::INLINE_PUBLIC => true, |
120 | 132 | ]); |
| 133 | + $rectorConfig->rule(StringClassNameToClassConstantRector::class); |
| 134 | + $rectorConfig->rule(PrivatizeFinalClassPropertyRector::class); |
| 135 | + $rectorConfig->rule(CompleteDynamicPropertiesRector::class); |
121 | 136 | }; |
0 commit comments