|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | 5 | use Rector\Config\RectorConfig; |
6 | | -use Rector\Doctrine\Set\DoctrineSetList; |
7 | | -use Rector\PHPUnit\Set\PHPUnitLevelSetList; |
8 | | -use Rector\PHPUnit\Set\PHPUnitSetList; |
9 | | -use Rector\Set\ValueObject\LevelSetList; |
10 | | -use Rector\Set\ValueObject\SetList; |
11 | | -use Rector\Symfony\Set\SymfonyLevelSetList; |
12 | 6 | use Rector\Symfony\Set\SymfonySetList; |
13 | | -use Sulu\Rector\Set\SuluLevelSetList; |
14 | 7 |
|
15 | | -return static function (RectorConfig $rectorConfig): void { |
16 | | - $rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']); |
17 | | - |
18 | | - $rectorConfig->phpstanConfigs([ |
| 8 | +return RectorConfig::configure() |
| 9 | + ->withPaths([ |
| 10 | + __DIR__ . '/src', |
| 11 | + __DIR__ . '/tests', |
| 12 | + ]) |
| 13 | + ->withRootFiles() |
| 14 | + ->withPHPStanConfigs([ |
19 | 15 | __DIR__ . '/phpstan.dist.neon', |
20 | 16 | // rector does not load phpstan extension automatically so require them manually here: |
21 | 17 | __DIR__ . '/vendor/phpstan/phpstan-doctrine/extension.neon', |
22 | 18 | __DIR__ . '/vendor/phpstan/phpstan-symfony/extension.neon', |
23 | | - ]); |
24 | | - |
25 | | - // basic rules |
26 | | - $rectorConfig->importNames(); |
27 | | - $rectorConfig->importShortClasses(false); |
28 | | - |
29 | | - $rectorConfig->sets([ |
30 | | - SetList::CODE_QUALITY, |
31 | | - LevelSetList::UP_TO_PHP_81, |
32 | | - ]); |
| 19 | + ]) |
| 20 | + ->withImportNames(importShortClasses: false) |
| 21 | + ->withPreparedSets(codeQuality: true, doctrineCodeQuality: true) |
| 22 | + ->withPhpSets() |
33 | 23 |
|
34 | 24 | // symfony rules |
35 | | - $rectorConfig->symfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml'); |
36 | | - |
37 | | - $rectorConfig->sets([ |
| 25 | + ->withSymfonyContainerPhp(__DIR__ . '/var/cache/website/dev/App_KernelDevDebugContainer.xml') |
| 26 | + ->withSets([ |
38 | 27 | SymfonySetList::SYMFONY_CODE_QUALITY, |
39 | 28 | SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION, |
40 | 29 | // activate when doing updates: |
41 | 30 | // SymfonyLevelSetList::UP_TO_SYMFONY_63, |
42 | | - ]); |
43 | | - |
44 | | - // doctrine rules |
45 | | - $rectorConfig->sets([ |
46 | | - DoctrineSetList::DOCTRINE_CODE_QUALITY, |
47 | | - ]); |
48 | | - |
49 | | - // phpunit rules |
50 | | - $rectorConfig->sets([ |
51 | 31 | // activate when doing updates: |
52 | 32 | // PHPUnitLevelSetList::UP_TO_PHPUNIT_90, |
53 | 33 | // PHPUnitSetList::PHPUNIT_91, |
54 | | - ]); |
55 | | - |
56 | | - // sulu rules |
57 | | - $rectorConfig->sets([ |
| 34 | + // sulu rules |
58 | 35 | // activate for updates when doing updates: |
59 | 36 | // SuluLevelSetList::UP_TO_SULU_25, |
60 | 37 | ]); |
61 | | -}; |
0 commit comments