Skip to content

Commit ad5bccb

Browse files
committed
chore: update rector.php
1 parent 120584f commit ad5bccb

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

rector.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
4+
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
45
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
56
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
67
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
@@ -29,15 +30,23 @@
2930
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
3031
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
3132
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
32-
use Rector\Php74\Rector\Property\TypedPropertyRector;
33+
use Rector\PHPUnit\Rector\Class_\AnnotationWithValueToAttributeRector;
3334
use Rector\PHPUnit\Set\PHPUnitSetList;
35+
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
3436
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
3537
use Rector\Set\ValueObject\LevelSetList;
3638
use Rector\Set\ValueObject\SetList;
3739

3840
return static function (RectorConfig $rectorConfig): void {
39-
$rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitSetList::PHPUNIT_80]);
41+
$rectorConfig->sets([
42+
SetList::DEAD_CODE,
43+
LevelSetList::UP_TO_PHP_74,
44+
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
45+
PHPUnitSetList::PHPUNIT_100,
46+
]);
47+
4048
$rectorConfig->parallel();
49+
4150
// The paths to refactor (can also be supplied with CLI arguments)
4251
$rectorConfig->paths([
4352
__DIR__ . '/app/',
@@ -73,13 +82,14 @@
7382

7483
// Note: requires php 8
7584
RemoveUnusedPromotedPropertyRector::class,
85+
AnnotationWithValueToAttributeRector::class,
7686

7787
// Ignore tests that might make calls without a result
7888
RemoveEmptyMethodCallRector::class => [
7989
__DIR__ . '/tests',
8090
],
8191

82-
// Ignore files that should not be namespaced
92+
// Ignore files that should not be namespaced to their folder
8393
NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [
8494
__DIR__ . '/app/Helpers',
8595
],
@@ -90,6 +100,10 @@
90100
// May be uninitialized on purpose
91101
AddDefaultValueForUndefinedVariableRector::class,
92102
]);
103+
104+
// auto import fully qualified class names
105+
$rectorConfig->importNames();
106+
93107
$rectorConfig->rule(SimplifyUselessVariableRector::class);
94108
$rectorConfig->rule(RemoveAlwaysElseRector::class);
95109
$rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class);
@@ -112,9 +126,7 @@
112126
$rectorConfig->rule(MakeInheritedMethodVisibilitySameAsParentRector::class);
113127
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
114128
$rectorConfig->rule(NormalizeNamespaceByPSR4ComposerAutoloadRector::class);
115-
$rectorConfig
116-
->ruleWithConfiguration(TypedPropertyRector::class, [
117-
// Set to false if you use in libraries, or it does create breaking changes.
118-
TypedPropertyRector::INLINE_PUBLIC => false,
119-
]);
129+
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
130+
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
131+
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
120132
};

0 commit comments

Comments
 (0)