-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathrector.php
147 lines (135 loc) · 6.57 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Assign\RemoveDoubleAssignRector;
use Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector;
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPublicMethodParameterRector;
use Rector\DeadCode\Rector\Expression\RemoveDeadStmtRector;
use Rector\DeadCode\Rector\If_\RemoveAlwaysTrueIfConditionRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureNeverReturnTypeRector;
use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src/*/src',
__DIR__ . '/src/*/*/src',
__DIR__ . '/src/*/*/tests',
__DIR__ . '/src/*/tests',
__DIR__ . '/tests',
])
->withParallel()
->withSkip([
IfIssetToCoalescingRector::class,
RemoveUnusedPrivatePropertyRector::class => [
__DIR__ . '/src/Scaffolder/src/Command/BootloaderCommand.php',
__DIR__ . '/src/Scaffolder/src/Command/CommandCommand.php',
__DIR__ . '/src/Scaffolder/src/Command/ConfigCommand.php',
__DIR__ . '/src/Scaffolder/src/Command/ControllerCommand.php',
__DIR__ . '/src/Scaffolder/src/Command/FilterCommand.php',
__DIR__ . '/src/Scaffolder/src/Command/JobHandlerCommand.php',
__DIR__ . '/src/Scaffolder/src/Command/MiddlewareCommand.php',
__DIR__ . '/src/Console/tests/PromptArgumentsTest.php',
],
RemoveUnusedPrivateMethodRector::class => [
__DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php',
__DIR__ . '/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php',
__DIR__ . '/src/Cache/src/Bootloader/CacheBootloader.php',
__DIR__ . '/src/Serializer/src/Bootloader/SerializerBootloader.php',
__DIR__ . '/src/Validation/src/Bootloader/ValidationBootloader.php',
__DIR__ . '/src/Translator/tests/IndexerTest.php',
__DIR__ . '/src/Tokenizer/tests/ReflectionFileTest.php',
__DIR__ . '/src/Core/tests/SingletonsTest.php',
],
RemoveUselessVarTagRector::class => [
__DIR__ . '/src/Console/src/Traits/HelpersTrait.php',
],
RemoveAlwaysTrueIfConditionRector::class => [
__DIR__ . '/src/Boot/src/BootloadManager/Initializer.php',
__DIR__ . '/src/Stempler/src/Traverser.php',
__DIR__ . '/src/Prototype/src/NodeVisitors/LocateProperties.php',
__DIR__ . '/src/Prototype/src/NodeVisitors/RemoveTrait.php',
__DIR__ . '/src/Logger/src/ListenerRegistry.php',
__DIR__ . '/src/Stempler/src/Transform/Merge/ExtendsParent.php',
__DIR__ . '/src/Bridge/Stempler/src/StemplerEngine.php',
],
RemoveExtraParametersRector::class => [
__DIR__ . '/src/Boot/src/BootloadManager/AbstractBootloadManager.php',
],
RemoveUnusedPrivateMethodParameterRector::class => [
__DIR__ . '/src/Core/src/Internal/Factory.php',
__DIR__ . '/src/Core/tests/InjectableTest.php',
],
RemoveDoubleAssignRector::class => [
__DIR__ . '/src/Core/tests/Scope/FinalizeAttributeTest.php',
],
RemoveUnusedVariableAssignRector::class => [
__DIR__ . '/src/Core/tests/ExceptionsTest.php',
],
RemoveDeadStmtRector::class => [
__DIR__ . '/src/Core/tests/ExceptionsTest.php',
],
// to be enabled later for bc break 4.x
RemoveUnusedPublicMethodParameterRector::class,
RemoveEmptyClassMethodRector::class,
RemoveUnusedPromotedPropertyRector::class,
NewInInitializerRector::class,
// start with short open tag
__DIR__ . '/src/Views/tests/fixtures/other/var.php',
__DIR__ . '/tests/app/views/native.php',
// example code for test
'*/Fixture/*',
'*/Fixtures/*',
'*/fixtures/*',
'*/Stub/*',
'*/Stubs/*',
'*/tests/Classes/*',
'*/tests/Internal/*',
__DIR__ . '/src/Console/tests/Configurator',
// cache
'*/runtime/cache/*',
ReadOnlyPropertyRector::class => [
// used by Configurator
__DIR__ . '/src/Scaffolder/src/Command',
],
FirstClassCallableRector::class => [
__DIR__ . '/src/Core/tests/Scope/UseCaseTest.php',
],
PreferPHPUnitThisCallRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class => [
__DIR__ . '/src/Models/tests/PublicEntity.php',
],
// Explicit behavior is more preferable
AssertCountWithZeroToAssertEmptyRector::class,
])
->withPhpSets(php81: true)
->withPreparedSets(deadCode: true, phpunitCodeQuality: true)
->withComposerBased(phpunit: true)
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
ClassPropertyAssignToConstructorPromotionRector::RENAME_PROPERTY => false,
])
->withTypeCoverageLevel(5)
->withRules([
ClosureReturnTypeRector::class,
TypedPropertyFromStrictSetUpRector::class,
PreferPHPUnitSelfCallRector::class,
TypedPropertyFromAssignsRector::class,
AddClosureNeverReturnTypeRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class,
]);