-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
rector.php
82 lines (73 loc) · 2.54 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
<?php
declare(strict_types=1);
/*
* This file is part of TYPO3 Core Patches.
*
* (c) Gilbertsoft LLC (gilbertsoft.org)
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
use Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;
use Rector\PHPUnit\Rector\Class_\AddProphecyTraitRector;
use Rector\PHPUnit\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);
$rectorConfig->bootstrapFiles([
__DIR__ . '/vendor/autoload.php',
__DIR__ . '/tools/phpunit/vendor/autoload.php',
]);
$rectorConfig->importNames();
$rectorConfig->importShortClasses();
$rectorConfig->removeUnusedImports();
// Define what rule sets will be applied
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
DowngradeLevelSetList::DOWN_TO_PHP_74,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
SetList::STRICT_BOOLEANS,
SetList::NAMING,
SetList::PRIVATIZATION,
SetList::TYPE_DECLARATION,
SetList::EARLY_RETURN,
SetList::INSTANCEOF,
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
PHPUnitSetList::PHPUNIT_91,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::REMOVE_MOCKS,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
$rectorConfig->skip([
AddProphecyTraitRector::class => [
__DIR__ . '/tests/*',
],
FinalizeClassesWithoutChildrenRector::class => [
__DIR__ . '/src/Exception/RuntimeException.php',
__DIR__ . '/src/Utility/*',
],
PreferPHPUnitThisCallRector::class => [
__DIR__ . '/tests/*',
],
RemoveEmptyMethodCallRector::class => [
__DIR__ . '/tests/*',
],
RenameVariableToMatchMethodCallReturnTypeRector::class => [
__DIR__ . '/tests/*',
],
]);
};