Skip to content

Commit c9bd934

Browse files
committed
chore: update rector.php
1 parent 9ae1651 commit c9bd934

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

rector.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,28 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14+
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
1415
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
1516
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
17+
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
1618
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
1719
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
1820
use Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector;
1921
use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
2022
use Rector\CodeQuality\Rector\FuncCall\SimplifyStrposLowerRector;
23+
use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector;
2124
use Rector\CodeQuality\Rector\FunctionLike\SimplifyUselessVariableRector;
2225
use Rector\CodeQuality\Rector\If_\CombineIfRector;
26+
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
2327
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
2428
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
2529
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
30+
use Rector\CodeQuality\Rector\Ternary\TernaryEmptyArrayArrayDimFetchToCoalesceRector;
2631
use Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector;
2732
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
2833
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
2934
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
35+
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
3036
use Rector\Config\RectorConfig;
3137
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
3238
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
@@ -38,12 +44,16 @@
3844
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
3945
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
4046
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
47+
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
4148
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
4249
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
4350
use Rector\PHPUnit\Set\PHPUnitSetList;
4451
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
4552
use Rector\Set\ValueObject\LevelSetList;
4653
use Rector\Set\ValueObject\SetList;
54+
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
55+
use Rector\Strict\Rector\If_\BooleanInIfConditionRuleFixerRector;
56+
use Rector\TypeDeclaration\Rector\Empty_\EmptyOnNullableObjectToInstanceOfRector;
4757
use Rector\ValueObject\PhpVersion;
4858

4959
return static function (RectorConfig $rectorConfig): void {
@@ -56,6 +66,12 @@
5666

5767
$rectorConfig->parallel();
5868

69+
// Github action cache
70+
$rectorConfig->cacheClass(FileCacheStorage::class);
71+
if (is_dir('/tmp')) {
72+
$rectorConfig->cacheDirectory('/tmp/rector');
73+
}
74+
5975
// The paths to refactor (can also be supplied with CLI arguments)
6076
$rectorConfig->paths([
6177
__DIR__ . '/src/',
@@ -89,6 +105,7 @@
89105
__DIR__ . '/src/Views',
90106

91107
JsonThrowOnErrorRector::class,
108+
StringifyStrNeedlesRector::class,
92109
YieldDataProviderRector::class,
93110

94111
// Note: requires php 8
@@ -140,7 +157,15 @@
140157
$rectorConfig->rule(FuncGetArgsToVariadicParamRector::class);
141158
$rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
142159
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
160+
$rectorConfig->rule(SimplifyEmptyCheckOnEmptyArrayRector::class);
161+
$rectorConfig->rule(TernaryEmptyArrayArrayDimFetchToCoalesceRector::class);
162+
$rectorConfig->rule(EmptyOnNullableObjectToInstanceOfRector::class);
163+
$rectorConfig->rule(DisallowedEmptyRuleFixerRector::class);
143164
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
144165
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
145166
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
167+
$rectorConfig->rule(BooleanInIfConditionRuleFixerRector::class);
168+
$rectorConfig->rule(SingleInArrayToCompareRector::class);
169+
$rectorConfig->rule(VersionCompareFuncCallToConstantRector::class);
170+
$rectorConfig->rule(ExplicitBoolCompareRector::class);
146171
};

0 commit comments

Comments
 (0)