Repository navigation
Expand file tree
/
Copy pathrector.php
More file actions
131 lines (117 loc) · 5.59 KB
/
Copy pathrector.php
File metadata and controls
131 lines (117 loc) · 5.59 KB
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
<?php
declare(strict_types=1);
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
use Rector\Config\RectorConfig;
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\If_\RemoveAlwaysTrueIfConditionRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Ternary\TernaryToNullsafeCoalesceRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\TypeDeclaration\Rector\ArrowFunction\AddArrowFunctionReturnTypeRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureNeverReturnTypeRector;
use Rector\TypeDeclaration\Rector\Closure\ClosureReturnTypeRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictSetUpRector;
use Rector\ValueObject\PhpVersion;
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/Console/tests/PromptArgumentsTest.php',
],
RemoveUnusedPrivateMethodRector::class => [
__DIR__ . '/src/Translator/tests/IndexerTest.php',
__DIR__ . '/src/Tokenizer/tests/ReflectionFileTest.php',
],
RemoveAlwaysTrueIfConditionRector::class => [
// Keep the is_string() guard: getBindings() reads user config, so a
// malformed (non-string) binding must be skipped, not crash class_exists().
__DIR__ . '/src/Prototype/src/Bootloader/PrototypeBootloader.php',
],
TernaryToNullsafeCoalesceRector::class => [
// A null returned by the core must not fall through to the handler,
// which is always null when the core is set.
__DIR__ . '/src/Hmvc/src/InterceptorPipeline.php',
],
RemoveUnusedPrivateMethodParameterRector::class => [
__DIR__ . '/src/Core/tests/InjectableTest.php',
],
// to be enabled later for bc break 4.x
RemoveUnusedPublicMethodParameterRector::class,
RemoveEmptyClassMethodRector::class,
RemoveUnusedPromotedPropertyRector::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',
],
ArrayToFirstClassCallableRector::class => [
__DIR__ . '/src/Core/tests/InvokerTest.php',
],
AddArrowFunctionReturnTypeRector::class => [
// untyped factory closure is the subject of the test
__DIR__ . '/src/Core/tests/InvokerTest.php',
],
PreferPHPUnitThisCallRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class => [
__DIR__ . '/src/Models/tests/PublicEntity.php',
],
TypedPropertyFromAssignsRector::class => [
// casted value
__DIR__ . '/src/Models/tests/NameValue.php'
],
// to be enabled later for easier to review
\Rector\PHPUnit\CodeQuality\Rector\MethodCall\WithCallbackIdenticalToStandaloneAssertsRector::class,
\Rector\PHPUnit\CodeQuality\Rector\MethodCall\SimplerWithIsInstanceOfRector::class,
\Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector::class,
\Rector\DeadCode\Rector\Property\RemoveDefaultValueFromAssignedPropertyRector::class,
\Rector\DeadCode\Rector\StmtsAwareInterface\RemoveDeadInstanceOfAssertRector::class,
])
// Stays on 8.1 until the code is migrated to 8.2 features; otherwise the version is taken from composer.json.
->withPhpVersion(PhpVersion::PHP_81)
->withPhpSets(php81: true)
->withPreparedSets(deadCode: true, phpunitCodeQuality: true)
->withComposerBased(phpunit: true)
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
ClassPropertyAssignToConstructorPromotionRector::RENAME_PROPERTY => false,
])
->withTypeCoverageLevel(23)
->withRules([
ClosureReturnTypeRector::class,
TypedPropertyFromStrictSetUpRector::class,
PreferPHPUnitSelfCallRector::class,
TypedPropertyFromAssignsRector::class,
AddClosureNeverReturnTypeRector::class,
MakeInheritedMethodVisibilitySameAsParentRector::class,
])
->reportUnusedSkips();