forked from DamienHarper/auditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rector.php
70 lines (62 loc) · 2.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
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Rector\Class_\MakeCommandLazyRector;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Transform\Rector\Attribute\AttributeKeyToClassConstFetchRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector;
use Rector\Privatization\Rector\Property\ChangeReadOnlyPropertyWithDefaultValueToConstantRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([__DIR__.'/src', __DIR__.'/tests']);
// Do not try to change simple property init and assign to constructor promotion
// to make code easier to read (no more class with properties declared both
// at the start of the class and in the constructor)
$rectorConfig->skip([
ClassPropertyAssignToConstructorPromotionRector::class,
RemoveUnusedPrivatePropertyRector::class,
AttributeKeyToClassConstFetchRector::class,
MakeCommandLazyRector::class,
AddArrayReturnDocTypeRector::class,
AddArrayParamDocTypeRector::class,
ChangeReadOnlyPropertyWithDefaultValueToConstantRector::class,
]);
// PHP rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,
SetList::PRIVATIZATION,
]);
// Symfony rules
$rectorConfig->sets([
SymfonySetList::SYMFONY_54,
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
// Doctrine rules
$rectorConfig->sets([
DoctrineSetList::DOCTRINE_CODE_QUALITY,
DoctrineSetList::DOCTRINE_DBAL_30,
DoctrineSetList::DOCTRINE_ORM_29,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
DoctrineSetList::GEDMO_ANNOTATIONS_TO_ATTRIBUTES,
]);
// PHPUnit rules
$rectorConfig->sets([
PHPUnitSetList::PHPUNIT_91,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
};