|
7 | 7 | use Rector\CodingStyle\Rector as CodingStyle;
|
8 | 8 | use Rector\Config\RectorConfig;
|
9 | 9 | use Rector\DeadCode\Rector as DeadCode;
|
| 10 | +use Rector\EarlyReturn\Rector as EarlyReturn; |
10 | 11 | use Rector\Exception\Configuration\InvalidConfigurationException;
|
11 | 12 | use Rector\Php53\Rector as Php53;
|
12 | 13 | use Rector\Php71\Rector as Php71;
|
|
18 | 19 | use Rector\Php83\Rector as Php83;
|
19 | 20 | use Rector\Php84\Rector as Php84;
|
20 | 21 | use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
|
| 22 | +use Rector\Privatization\Rector as Privatization; |
| 23 | +use Rector\Renaming\Rector as Renaming; |
| 24 | +use Rector\Strict\Rector as Strict; |
| 25 | +use Rector\Transform\Rector as Transform; |
21 | 26 | use Rector\TypeDeclaration\Rector as TypeDeclaration;
|
22 | 27 |
|
23 | 28 | try {
|
|
28 | 33 | cacheClass: FileCacheStorage::class,
|
29 | 34 | )
|
30 | 35 | ->withPhpSets(
|
31 |
| - php74: true, |
| 36 | + php81: true, |
32 | 37 | )
|
33 | 38 | ->withPaths([
|
34 | 39 | __DIR__,
|
35 | 40 | ])
|
36 | 41 | ->withSkipPath(__DIR__ . '/vendor')
|
37 | 42 | ->withSkip([
|
| 43 | + CodeQuality\Assign\CombinedAssignRector::class, # todo: TMP |
38 | 44 | CodeQuality\BooleanNot\SimplifyDeMorganBinaryRector::class,
|
| 45 | + # skip: causes issues with Mage_Api2_Model_Auth_Adapter_Oauth::getUserParams() |
| 46 | + CodeQuality\Catch_\ThrowWithPreviousExceptionRector::class => [ |
| 47 | + __DIR__ . '/app/code/core/Mage/Api2/Model/Auth/Adapter/Oauth.php', |
| 48 | + ], |
| 49 | + CodeQuality\Class_\CompleteDynamicPropertiesRector::class, # todo: TMP (!?!) |
| 50 | + CodeQuality\Class_\InlineConstructorDefaultToPropertyRector::class, # todo: TMP |
| 51 | + CodeQuality\ClassMethod\ExplicitReturnNullRector::class, # todo: TMP |
| 52 | + CodeQuality\Concat\JoinStringConcatRector::class, # todo: TMP |
| 53 | + CodeQuality\Empty_\SimplifyEmptyCheckOnEmptyArrayRector::class, # todo: TMP |
| 54 | + CodeQuality\Equal\UseIdenticalOverEqualWithSameTypeRector::class, # todo: TMP |
| 55 | + CodeQuality\Expression\InlineIfToExplicitIfRector::class, # todo: TMP (!?!) |
| 56 | + CodeQuality\Expression\TernaryFalseExpressionToIfRector::class, # todo: TMP (!?!) |
| 57 | + CodeQuality\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class, # todo: TMP |
| 58 | + CodeQuality\FunctionLike\SimplifyUselessVariableRector::class, # todo: TMP |
| 59 | + CodeQuality\Identical\SimplifyBoolIdenticalTrueRector::class, # todo: TMP |
| 60 | + CodeQuality\Identical\SimplifyConditionsRector::class, # todo: TMP |
| 61 | + CodeQuality\If_\CombineIfRector::class, # todo: TMP< |
| 62 | + CodeQuality\If_\CompleteMissingIfElseBracketRector::class, # todo: TMP (!?!) |
| 63 | + CodeQuality\If_\ExplicitBoolCompareRector::class, # todo: TMP |
| 64 | + CodeQuality\If_\SimplifyIfElseToTernaryRector::class, |
39 | 65 | CodeQuality\If_\SimplifyIfReturnBoolRector::class,
|
| 66 | + CodeQuality\Include_\AbsolutizeRequireAndIncludePathRector::class, # todo: TMP |
| 67 | + CodeQuality\Isset_\IssetOnPropertyObjectToPropertyExistsRector::class, # todo: TMP |
| 68 | + CodeQuality\Ternary\SwitchNegatedTernaryRector::class, # todo: TMP |
| 69 | + CodeQuality\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector::class, # todo: TMP |
| 70 | + CodeQuality\Ternary\UnnecessaryTernaryExpressionRector::class, # todo: TMP |
| 71 | + CodingStyle\Assign\SplitDoubleAssignRector::class, # todo: TMP |
| 72 | + CodingStyle\Catch_\CatchExceptionNameMatchingTypeRector::class, # todo: TMP |
| 73 | + CodingStyle\ClassMethod\FuncGetArgsToVariadicParamRector::class, # todo: TMP |
| 74 | + CodingStyle\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector::class, # todo: TMP |
| 75 | + CodingStyle\ClassMethod\NewlineBeforeNewAssignSetRector::class, # todo: TMP |
| 76 | + CodingStyle\Encapsed\EncapsedStringsToSprintfRector::class, # todo: TMP |
| 77 | + CodingStyle\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class, # todo: TMP |
| 78 | + CodingStyle\FuncCall\CallUserFuncArrayToVariadicRector::class, # todo: TMP |
| 79 | + CodingStyle\FuncCall\CountArrayToEmptyArrayComparisonRector::class, # todo: TMP |
| 80 | + CodingStyle\FuncCall\StrictArraySearchRector::class, # todo: TMP |
| 81 | + CodingStyle\If_\NullableCompareToNullRector::class, # todo: TMP |
| 82 | + CodingStyle\PostInc\PostIncDecToPreIncDecRector::class, # todo: TMP |
| 83 | + CodingStyle\Stmt\NewlineAfterStatementRector::class, # todo: TMP |
| 84 | + CodingStyle\String_\SymplifyQuoteEscapeRector::class, # todo: TMP |
| 85 | + DeadCode\Assign\RemoveUnusedVariableAssignRector::class, # todo: TMP |
| 86 | + DeadCode\Cast\RecastingRemovalRector::class, # todo: TMP (!?!) |
| 87 | + DeadCode\ClassMethod\RemoveUnusedConstructorParamRector::class, # todo: TMP (!?!) |
| 88 | + DeadCode\ClassMethod\RemoveEmptyClassMethodRector::class, # todo: TMP |
| 89 | + DeadCode\ClassMethod\RemoveNullTagValueNodeRector::class, # todo: TMP |
| 90 | + DeadCode\ClassMethod\RemoveUnusedPrivateMethodParameterRector::class, # todo: TMP (!?!) |
| 91 | + DeadCode\Concat\RemoveConcatAutocastRector::class, # todo: TMP (!?!) |
| 92 | + DeadCode\Foreach_\RemoveUnusedForeachKeyRector::class, # todo: TMP |
| 93 | + DeadCode\FunctionLike\RemoveDeadReturnRector::class, # todo: TMP |
| 94 | + DeadCode\If_\ReduceAlwaysFalseIfOrRector::class, # todo: TMP |
| 95 | + DeadCode\If_\RemoveAlwaysTrueIfConditionRector::class, # todo: TMP |
| 96 | + DeadCode\If_\RemoveDeadInstanceOfRector::class, # todo: TMP |
| 97 | + DeadCode\If_\RemoveUnusedNonEmptyArrayBeforeForeachRector::class, # todo: TMP |
| 98 | + DeadCode\If_\SimplifyIfElseWithSameContentRector::class, # todo: TMP |
| 99 | + DeadCode\Node\RemoveNonExistingVarAnnotationRector::class, # todo: TMP (!?!) |
| 100 | + DeadCode\Plus\RemoveDeadZeroAndOneOperationRector::class, # todo: TMP (!?!) |
| 101 | + DeadCode\Property\RemoveUnusedPrivatePropertyRector::class, # todo: TMP |
| 102 | + DeadCode\PropertyProperty\RemoveNullPropertyInitializationRector::class, # todo: TMP |
| 103 | + DeadCode\Switch_\RemoveDuplicatedCaseInSwitchRector::class, # todo: TMP (!?!) |
| 104 | + DeadCode\Ternary\TernaryToBooleanOrFalseToBooleanAndRector::class, # todo: TMP |
| 105 | + DeadCode\TryCatch\RemoveDeadTryCatchRector::class, # todo: TMP (!?!) |
| 106 | + EarlyReturn\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector::class, # todo: TMP |
| 107 | + EarlyReturn\If_\ChangeIfElseValueAssignToEarlyReturnRector::class, # todo: TMP |
| 108 | + EarlyReturn\If_\ChangeNestedIfsToEarlyReturnRector::class, # todo: TMP |
| 109 | + EarlyReturn\If_\ChangeOrIfContinueToMultiContinueRector::class, # todo: TMP |
| 110 | + EarlyReturn\If_\RemoveAlwaysElseRector::class, # todo: TMP |
| 111 | + EarlyReturn\Return_\ReturnBinaryOrToEarlyReturnRector::class, # todo: TMP |
| 112 | + EarlyReturn\Return_\PreparedValueToEarlyReturnRector::class, # todo: TMP |
| 113 | + EarlyReturn\StmtsAwareInterface\ReturnEarlyIfVariableRector::class, # todo: TMP |
40 | 114 | # skip: may conflict with phpstan strict rules
|
41 | 115 | Php53\Ternary\TernaryToElvisRector::class,
|
42 | 116 | Php71\FuncCall\RemoveExtraParametersRector::class, # todo: check later
|
|
46 | 120 | Php74\Closure\ClosureToArrowFunctionRector::class,
|
47 | 121 | # skip: causes issues
|
48 | 122 | Php74\Assign\NullCoalescingOperatorRector::class,
|
| 123 | + Php80\Catch_\RemoveUnusedVariableInCatchRector::class, # todo: TMP |
49 | 124 | Php80\Class_\AnnotationToAttributeRector::class, # todo: wait for php80
|
50 | 125 | Php80\Class_\ClassPropertyAssignToConstructorPromotionRector::class, # todo: wait for php80
|
51 | 126 | Php80\Class_\StringableForToStringRector::class, # todo: wait for php80
|
| 127 | + Php80\ClassMethod\AddParamBasedOnParentClassMethodRector::class, # todo: TMP |
| 128 | + Php81\Array_\FirstClassCallableRector::class, # todo: TMP |
| 129 | + Php81\FuncCall\NullToStrictStringFuncCallArgRector::class, # todo: check later |
| 130 | + Strict\Empty_\DisallowedEmptyRuleFixerRector::class, # todo: TMP |
| 131 | + TypeDeclaration\BooleanAnd\BinaryOpNullableToInstanceofRector::class, # todo: TMP |
52 | 132 | TypeDeclaration\ClassMethod\ReturnNeverTypeRector::class,
|
53 |
| - # use static methods |
| 133 | + # skip: cannot be applied to OpenMage codebase - yet |
| 134 | + TypeDeclaration\StmtsAwareInterface\DeclareStrictTypesRector::class, |
| 135 | + # skip: use static methods |
54 | 136 | PreferPHPUnitThisCallRector::class,
|
55 | 137 | __DIR__ . '/shell/translations.php',
|
56 | 138 | __DIR__ . '/shell/update-copyright.php',
|
57 | 139 | __DIR__ . '/tests/unit/Mage/Reports/Model/Resource/Report/CollectionTest.php',
|
58 | 140 | ])
|
59 |
| - ->withRules([ |
60 |
| - CodeQuality\BooleanNot\ReplaceMultipleBooleanNotRector::class, |
61 |
| - CodeQuality\Foreach_\UnusedForeachValueToArrayKeysRector::class, |
62 |
| - CodeQuality\FuncCall\ChangeArrayPushToArrayAssignRector::class, |
63 |
| - CodeQuality\FuncCall\CompactToVariablesRector::class, |
64 |
| - CodeQuality\FunctionLike\SimplifyUselessVariableRector::class, |
65 |
| - CodeQuality\Identical\SimplifyArraySearchRector::class, |
66 |
| - CodeQuality\Identical\SimplifyConditionsRector::class, |
67 |
| - CodeQuality\Identical\StrlenZeroToIdenticalEmptyStringRector::class, |
68 |
| - CodeQuality\NotEqual\CommonNotEqualRector::class, |
69 |
| - CodeQuality\LogicalAnd\LogicalToBooleanRector::class, |
70 |
| - CodeQuality\Ternary\SimplifyTautologyTernaryRector::class, |
71 |
| - CodingStyle\FuncCall\ConsistentImplodeRector::class, |
72 |
| - DeadCode\ClassMethod\RemoveUselessParamTagRector::class, |
73 |
| - DeadCode\ClassMethod\RemoveUselessReturnTagRector::class, |
74 |
| - DeadCode\Property\RemoveUselessVarTagRector::class, |
75 |
| - DeadCode\StaticCall\RemoveParentCallWithoutParentRector::class, |
76 |
| - ]) |
77 | 141 | ->withPreparedSets(
|
78 |
| - deadCode: false, |
79 |
| - codeQuality: false, |
80 |
| - codingStyle: false, |
| 142 | + deadCode: true, |
| 143 | + codeQuality: true, |
| 144 | + codingStyle: true, |
81 | 145 | typeDeclarations: false,
|
82 | 146 | privatization: true,
|
83 | 147 | naming: false,
|
84 |
| - instanceOf: false, |
85 |
| - earlyReturn: false, |
| 148 | + instanceOf: true, |
| 149 | + earlyReturn: true, |
86 | 150 | strictBooleans: false,
|
87 | 151 | carbon: false,
|
88 |
| - rectorPreset: false, |
| 152 | + rectorPreset: true, |
89 | 153 | phpunitCodeQuality: true,
|
90 | 154 | doctrineCodeQuality: false,
|
91 | 155 | symfonyCodeQuality: false,
|
|
0 commit comments