-
Notifications
You must be signed in to change notification settings - Fork 12k
Expand file tree
/
Copy pathrector.php
More file actions
115 lines (111 loc) · 5.34 KB
/
Copy pathrector.php
File metadata and controls
115 lines (111 loc) · 5.34 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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
use Rector\CodeQuality\Rector\FuncCall\SortCallLikeNamedArgsRector;
use Rector\CodeQuality\Rector\Identical\StrlenZeroToIdenticalEmptyStringRector;
use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector;
use Rector\CodingStyle\Rector\Closure\ClosureDelegatingCallToFirstClassCallableRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector;
use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector;
use Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php80\Rector\Ternary\GetDebugTypeRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
use Rector\Php83\Rector\FuncCall\DynamicClassConstFetchRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\AddInstanceofAssertForNullableInstanceRector;
use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\NoSetupWithParentCallOverrideRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertComparisonToSpecificMethodRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertEqualsToSameRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\StringCastAssertStringContainsStringRector;
use Rector\PHPUnit\CodeQuality\Rector\StmtsAwareInterface\DeclareStrictTypesTestsRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnNeverTypeRector;
$skipPHPUnitSetList = [
AddInstanceofAssertForNullableInstanceRector::class,
AssertComparisonToSpecificMethodRector::class,
AssertEmptyNullableObjectToAssertInstanceofRector::class,
AssertEqualsOrAssertSameFloatParameterToSpecificMethodsTypeRector::class,
AssertEqualsToSameRector::class,
AssertIssetToSpecificMethodRector::class,
DeclareStrictTypesTestsRector::class,
FinalizeTestCaseClassRector::class,
NarrowUnusedSetUpDefinedPropertyRector::class,
NoSetupWithParentCallOverrideRector::class,
StringCastAssertStringContainsStringRector::class,
YieldDataProviderRector::class,
];
return RectorConfig::configure()
->withRootFiles()
->withPaths([
__DIR__.'/config',
__DIR__.'/src',
__DIR__.'/tests',
__DIR__.'/types',
])
->withSkip([
...$skipPHPUnitSetList,
AddTypeToConstRector::class,
ArrayToFirstClassCallableRector::class,
ArrowFunctionDelegatingCallToFirstClassCallableRector::class,
BinaryOpBetweenNumberAndStringRector::class,
ChangeSwitchToMatchRector::class,
ClassConstantToSelfClassRector::class,
ClassOnObjectRector::class,
ClassOnThisVariableObjectRector::class,
ClassPropertyAssignToConstructorPromotionRector::class,
ClosureDelegatingCallToFirstClassCallableRector::class,
ClosureToArrowFunctionRector::class,
DynamicClassConstFetchRector::class,
FunctionFirstClassCallableRector::class,
GetDebugTypeRector::class,
RandomFunctionRector::class,
ReadOnlyPropertyRector::class,
RemoveExtraParametersRector::class,
ReturnNeverTypeRector::class,
StringClassNameToClassConstantRector::class,
StringableForToStringRector::class,
TernaryToNullCoalescingRector::class,
ThisCallOnStaticMethodToStaticCallRector::class,
'tests/Foundation/fixtures/bad-syntax-strategy.php',
])
->withRules([
CompactToVariablesRector::class,
SortCallLikeNamedArgsRector::class,
StrlenZeroToIdenticalEmptyStringRector::class,
])
->withPreparedSets(
deadCode: false,
codeQuality: false,
codingStyle: false,
typeDeclarations: false,
typeDeclarationDocblocks: false,
privatization: false,
naming: false,
instanceOf: false,
earlyReturn: false,
)
->withSets([
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_MOCK_TO_STUB,
])
->withPhpSets(php83: true);