-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrector.php
74 lines (62 loc) · 2.04 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
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\CodeQuality\Rector\ClassMethod\ActionSuffixRemoverRector;
use Rector\Symfony\Set\SymfonySetList;
use Sulu\Rector\Set\SuluLevelSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/Admin',
__DIR__ . '/Api',
__DIR__ . '/Controller',
__DIR__ . '/DependencyInjection',
__DIR__ . '/Entity',
__DIR__ . '/Preview',
__DIR__ . '/Repository',
__DIR__ . '/Resources',
__DIR__ . '/Routing',
__DIR__ . '/Service',
]);
$rectorConfig->phpstanConfigs([
__DIR__ . '/phpstan.neon',
// rector does not load phpstan extension automatically so require them manually here:
__DIR__ . '/vendor/phpstan/phpstan-doctrine/extension.neon',
__DIR__ . '/vendor/phpstan/phpstan-symfony/extension.neon',
]);
// basic rules
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
$rectorConfig->sets([
SetList::CODE_QUALITY,
LevelSetList::UP_TO_PHP_83,
]);
// symfony rules
$rectorConfig->symfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml');
$rectorConfig->sets([
SymfonySetList::SYMFONY_CODE_QUALITY,
SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION,
SymfonySetList::SYMFONY_71,
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
// doctrine rules
$rectorConfig->sets([
DoctrineSetList::DOCTRINE_CODE_QUALITY,
]);
// phpunit rules
$rectorConfig->sets([
PHPUnitSetList::PHPUNIT_100,
]);
// sulu rules
$rectorConfig->sets([
SuluLevelSetList::UP_TO_SULU_25,
]);
// Skip
$rectorConfig->skip([
ActionSuffixRemoverRector::class,
]);
};