-
Notifications
You must be signed in to change notification settings - Fork 0
/
rector.php
86 lines (77 loc) · 3.56 KB
/
rector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\FuncCall\RemoveSoleValueSprintfRector;
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Array_\RemoveDuplicatedArrayKeyRector;
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
use Rector\DeadCode\Rector\If_\ReduceAlwaysFalseIfOrRector;
use Rector\DeadCode\Rector\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector;
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
use Rector\DeadCode\Rector\Property\RemoveUselessReadOnlyTagRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector;
use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Php80\Rector\Identical\StrEndsWithRector;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Privatization\Rector\ClassMethod\PrivatizeFinalClassMethodRector;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
$config = RectorConfig::configure()
->withCache(__DIR__ . '/var/rector')
->withPaths([
__DIR__ . '/src',
])
->withParallel()
->withRules([
// Misc
PrivatizeFinalClassPropertyRector::class,
PrivatizeFinalClassMethodRector::class,
UnwrapSprintfOneArgumentRector::class,
RemoveSoleValueSprintfRector::class,
CountArrayToEmptyArrayComparisonRector::class,
// See withConfiguredRule below for more
// Misc - Deadcode
RemoveUnusedForeachKeyRector::class,
RemoveDuplicatedArrayKeyRector::class,
RecastingRemovalRector::class,
RemoveUnusedNonEmptyArrayBeforeForeachRector::class,
TernaryToBooleanOrFalseToBooleanAndRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUselessReadOnlyTagRector::class,
RemoveNonExistingVarAnnotationRector::class,
RemoveUselessVarTagRector::class,
ReduceAlwaysFalseIfOrRector::class,
// PHP 8.0
ClassOnThisVariableObjectRector::class,
ClassOnObjectRector::class,
StrStartsWithRector::class,
StrEndsWithRector::class,
StrContainsRector::class,
RemoveUnusedVariableInCatchRector::class,
// PHP 8.1
ReadOnlyPropertyRector::class,
FirstClassCallableRector::class,
// PHP 8.2
ReadOnlyClassRector::class,
// PHP 8.3
AddTypeToConstRector::class,
AddOverrideAttributeToOverriddenMethodsRector::class,
])
->withConfiguredRule(SimplifyUselessVariableRector::class, [
SimplifyUselessVariableRector::ONLY_DIRECT_ASSIGN => true,
]);
return $config;