Skip to content

Commit d463a5a

Browse files
committed
AC-1740: Add rectorphp as a dependency to magento-coding-standard and run it as part of the GitHub actions
1 parent 5ebccb0 commit d463a5a

File tree

1 file changed

+11
-44
lines changed

1 file changed

+11
-44
lines changed

rector.php

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,11 @@
44

55
use Rector\Core\Configuration\Option;
66
use Rector\Core\ValueObject\PhpVersion;
7-
use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
8-
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
9-
use Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector;
10-
use Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector;
11-
use Rector\Php80\Rector\FunctionLike\UnionTypesRector;
12-
use Rector\Php80\Rector\Identical\StrEndsWithRector;
13-
use Rector\Php80\Rector\Identical\StrStartsWithRector;
14-
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
15-
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
16-
use Rector\Php80\Rector\Ternary\GetDebugTypeRector;
17-
use Rector\Php81\Rector\Class_\MyCLabsClassToEnumRector;
18-
use Rector\Php81\Rector\Class_\SpatieEnumClassToEnumRector;
19-
use Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector;
20-
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
21-
use Rector\Php81\Rector\FunctionLike\IntersectionTypesRector;
22-
use Rector\Php81\Rector\MethodCall\MyCLabsMethodCallToEnumConstRector;
23-
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
24-
use Rector\Set\ValueObject\SetList;
7+
use Rector\Php80\Rector\Class_\StringableForToStringRector;
8+
use Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector;
9+
use Rector\Php80\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
10+
use Rector\Php80\Rector\ClassMethod\SetStateToStaticRector;
11+
use Rector\Php81\Rector\FuncCall\Php81ResourceReturnToObjectRector;
2512
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2613

2714
return static function (ContainerConfigurator $containerConfigurator): void {
@@ -36,34 +23,14 @@
3623

3724
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_80);
3825
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_81);
39-
40-
$parameters->set(Option::SKIP, [
41-
ReadOnlyPropertyRector::class,
42-
StrContainsRector::class,
43-
UnionTypesRector::class,
44-
StrStartsWithRector::class,
45-
StrEndsWithRector::class,
46-
FinalizePublicClassConstantRector::class,
47-
RemoveUnusedVariableInCatchRector::class,
48-
ClassOnObjectRector::class,
49-
Php8ResourceReturnToObjectRector::class,
50-
TokenGetAllToObjectRector::class,
51-
GetDebugTypeRector::class,
52-
ChangeSwitchToMatchRector::class,
53-
NewInInitializerRector::class,
54-
IntersectionTypesRector::class,
55-
MyCLabsMethodCallToEnumConstRector::class,
56-
MyCLabsClassToEnumRector::class,
57-
SpatieEnumClassToEnumRector::class
58-
]);
59-
60-
// Define what rule sets will be applied
61-
$containerConfigurator->import(SetList::PHP_80);
62-
$containerConfigurator->import(SetList::PHP_81);
6326

6427
// get services (needed for register a single rule)
65-
// $services = $containerConfigurator->services();
28+
$services = $containerConfigurator->services();
6629

6730
// register a single rule
68-
// $services->set(TypedPropertyRector::class);
31+
$services->set(FinalPrivateToPrivateVisibilityRector::class);
32+
$services->set(OptionalParametersAfterRequiredRector::class);
33+
$services->set(SetStateToStaticRector::class);
34+
$services->set(StringableForToStringRector::class);
35+
$services->set(Php81ResourceReturnToObjectRector::class);
6936
};

0 commit comments

Comments
 (0)