-
Notifications
You must be signed in to change notification settings - Fork 28
/
rector.php
101 lines (83 loc) · 3.55 KB
/
rector.php
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
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\FuncCall\SimplifyRegexPatternRector;
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\Config\RectorConfig;
use Rector\Doctrine\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\CodeQuality\Rector\Class_\EventListenerToEventSubscriberRector;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Transform\Rector\Attribute\AttributeKeyToClassConstFetchRector;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
use Rector\Php80\Rector\Identical\StrEndsWithRector;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
use Rector\Php74\Rector\Assign\NullCoalescingOperatorRector;
use Rector\Php71\Rector\List_\ListToArrayDestructRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/api',
__DIR__ . '/tests'
]);
$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml');
$rectorConfig->rules([
// PHP 7.1
ListToArrayDestructRector::class,
// PHP 7.4
RestoreDefaultNullToNullableTypePropertyRector::class,
NullCoalescingOperatorRector::class,
// PHP 8.0
ChangeSwitchToMatchRector::class,
ClassOnObjectRector::class,
StrContainsRector::class,
StrEndsWithRector::class,
StrStartsWithRector::class,
StringableForToStringRector::class,
// PHP 8.1
NewInInitializerRector::class,
ReadOnlyPropertyRector::class,
// PHP 8.2
ReadOnlyClassRector::class,
// PHP 8.3
AddOverrideAttributeToOverriddenMethodsRector::class,
AddTypeToConstRector::class,
//Type declaration
AddVoidReturnTypeWhereNoReturnRector::class,
]);
$rectorConfig->sets([
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SymfonySetList::SYMFONY_63,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
PHPUnitSetList::PHPUNIT_100,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
DoctrineSetList::DOCTRINE_CODE_QUALITY,
]);
$rectorConfig->skip([
EventListenerToEventSubscriberRector::class,
AttributeKeyToClassConstFetchRector::class,
ImproveDoctrineCollectionDocTypeInEntityRector::class,
EncapsedStringsToSprintfRector::class,
ExplicitBoolCompareRector::class,
RenameClassRector::class,
RenameClassConstFetchRector::class,
SimplifyRegexPatternRector::class
]);
};