|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | 5 | use Rector\Config\RectorConfig; |
6 | | -use Rector\Core\Configuration\Option; |
7 | 6 | use Rector\Core\ValueObject\PhpVersion; |
8 | 7 | use Rector\Set\ValueObject\SetList; |
9 | 8 | use RectorLaravel\Set\LaravelSetList; |
10 | 9 |
|
11 | 10 | return static function (RectorConfig $rectorConfig): void { |
12 | | - $parameters = $rectorConfig->parameters(); |
13 | | - $services = $rectorConfig->services(); |
14 | | - $dir = getcwd(); |
| 11 | + $dir = getcwd(); |
15 | 12 |
|
16 | 13 | $rectorConfig->sets([ |
17 | 14 | SetList::PRIVATIZATION, |
|
30 | 27 | */ |
31 | 28 | $rectorConfig->bootstrapFiles([$dir.'/vendor/arkecosystem/foundation/rector-bootstrap.php']); |
32 | 29 |
|
33 | | - $parameters->set(Option::PATHS, [ |
| 30 | + $rectorConfig->paths([ |
34 | 31 | $dir.'/app', |
35 | 32 | ]); |
36 | 33 |
|
37 | | - $parameters->set(Option::SKIP, [ |
| 34 | + $rectorConfig->skip([ |
38 | 35 | // skip Livewire |
39 | 36 | $dir.'/app/Http/Livewire', |
40 | | - $dir.'/app/App/Blog/Components', |
41 | 37 | $dir.'/app/App/Collaborator/Components', |
42 | 38 | $dir.'/app/App/Http/Components', |
43 | | - $dir.'/app/App/Platform/Components', |
44 | 39 | $dir.'/app/App/SecureShell/Components', |
45 | 40 | $dir.'/app/App/Server/Components', |
46 | 41 | $dir.'/app/App/Token/Components', |
|
60 | 55 | $rectorConfig->phpstanConfig($neon); |
61 | 56 | } |
62 | 57 |
|
63 | | - $services->remove(\Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector::class); |
64 | | - $services->remove(\Rector\Privatization\Rector\Class_\RepeatedLiteralToClassConstantRector::class); |
65 | | - $services->remove(\Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector::class); |
66 | | - $services->remove(\Rector\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector::class); |
67 | | - $services->remove(\Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector::class); |
68 | | - $services->remove(\Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector::class); |
69 | | - $services->remove(\Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector::class); |
70 | | - $services->remove(\Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector::class); |
71 | | - $services->remove(\Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector::class); |
72 | | - $services->remove(\Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class); |
73 | | - $services->remove(\Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector::class); |
| 58 | + $rectorConfig->skip([ |
| 59 | + \Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector::class, |
| 60 | + \Rector\Privatization\Rector\Class_\RepeatedLiteralToClassConstantRector::class, |
| 61 | + \Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector::class, |
| 62 | + \Rector\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector::class, |
| 63 | + \Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector::class, |
| 64 | + \Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector::class, |
| 65 | + \Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector::class, |
| 66 | + \Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector::class, |
| 67 | + \Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector::class, |
| 68 | + \Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class, |
| 69 | + \Rector\CodingStyle\Rector\FuncCall\ConsistentPregDelimiterRector::class, |
| 70 | + ]); |
74 | 71 |
|
75 | 72 | // Restoration |
76 | | - $services->set(\Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector::class); |
| 73 | + $rectorConfig->rule(\Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector::class); |
77 | 74 |
|
78 | 75 | // php5.5 |
79 | | - $services->set(\Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector::class); |
| 76 | + $rectorConfig->rule(\Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector::class); |
80 | 77 |
|
81 | 78 | // php7.4 |
82 | | - $services->set(\Rector\Php74\Rector\Property\TypedPropertyRector::class); |
83 | | - $services->set(\Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector::class); |
84 | | - $services->set(\Rector\Php74\Rector\Assign\NullCoalescingOperatorRector::class); |
85 | | - $services->set(\Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector::class); |
| 79 | + $rectorConfig->rule(\Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector::class); |
| 80 | + $rectorConfig->rule(\Rector\Php74\Rector\Assign\NullCoalescingOperatorRector::class); |
| 81 | + $rectorConfig->rule(\Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector::class); |
86 | 82 |
|
87 | 83 | // php8.0 |
88 | | - $services->set(\Rector\Php80\Rector\FunctionLike\UnionTypesRector::class); |
89 | | - $services->set(\Rector\Php80\Rector\NotIdentical\StrContainsRector::class); |
90 | | - $services->set(\Rector\Php80\Rector\Identical\StrStartsWithRector::class); |
91 | | - $services->set(\Rector\Php80\Rector\Identical\StrEndsWithRector::class); |
92 | | - $services->set(\Rector\Php80\Rector\Class_\StringableForToStringRector::class); |
93 | | - $services->set(\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class); |
94 | | - $services->set(\Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class); |
95 | | - $services->set(\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class); |
96 | | - $services->set(\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class); |
97 | | - $services->set(\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class); |
98 | | - $services->set(\Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class); |
99 | | - $services->set(\Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector::class); |
100 | | - $services->set(\Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class); |
| 84 | + $rectorConfig->rule(\Rector\Php80\Rector\FunctionLike\UnionTypesRector::class); |
| 85 | + $rectorConfig->rule(\Rector\Php80\Rector\NotIdentical\StrContainsRector::class); |
| 86 | + $rectorConfig->rule(\Rector\Php80\Rector\Identical\StrStartsWithRector::class); |
| 87 | + $rectorConfig->rule(\Rector\Php80\Rector\Identical\StrEndsWithRector::class); |
| 88 | + $rectorConfig->rule(\Rector\Php80\Rector\Class_\StringableForToStringRector::class); |
| 89 | + $rectorConfig->rule(\Rector\Php80\Rector\FuncCall\ClassOnObjectRector::class); |
| 90 | + $rectorConfig->rule(\Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class); |
| 91 | + $rectorConfig->rule(\Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector::class); |
| 92 | + $rectorConfig->rule(\Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector::class); |
| 93 | + $rectorConfig->rule(\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class); |
| 94 | + $rectorConfig->rule(\Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector::class); |
| 95 | + $rectorConfig->rule(\Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector::class); |
| 96 | + $rectorConfig->rule(\Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector::class); |
101 | 97 |
|
102 | 98 | // php8.1 |
103 | | - $services->set(\Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector::class); |
104 | | - $services->set(\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class); |
105 | | - $services->set(\Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector::class); |
106 | | - $services->set(\Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector::class); |
107 | | - $services->set(\Rector\Php81\Rector\FunctionLike\IntersectionTypesRector::class); |
| 99 | + $rectorConfig->rule(\Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector::class); |
| 100 | + $rectorConfig->rule(\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class); |
| 101 | + $rectorConfig->rule(\Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector::class); |
| 102 | + $rectorConfig->rule(\Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector::class); |
| 103 | + $rectorConfig->rule(\Rector\Php81\Rector\FunctionLike\IntersectionTypesRector::class); |
108 | 104 | }; |
0 commit comments