-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
rector.php
105 lines (94 loc) · 3.7 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
102
103
104
105
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
use Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector;
use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\ValueObject\PhpVersion;
use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector;
use Ssch\TYPO3Rector\CodeQuality\General\ExtEmConfRector;
use Ssch\TYPO3Rector\CodeQuality\General\InjectMethodToConstructorInjectionRector;
use Ssch\TYPO3Rector\Configuration\Typo3Option;
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;
use Ssch\TYPO3Rector\Set\Typo3SetList;
use Ssch\Typo3RectorTestingFramework\Set\TYPO3TestingFrameworkSetList;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/Classes/',
__DIR__ . '/Configuration/',
__DIR__ . '/Tests/',
__DIR__ . '/ext_emconf.php',
__DIR__ . '/ext_localconf.php',
__DIR__ . '/ext_tables.php',
])
->withPhpVersion(PhpVersion::PHP_74)
->withPhpSets(
true
)
// Note: We're only enabling a single set by default to improve performance. (Rector needs at least a single set to
// run.)
//
// You can temporarily enable more sets as needed.
->withSets([
// Rector sets
// LevelSetList::UP_TO_PHP_53,
// LevelSetList::UP_TO_PHP_54,
// LevelSetList::UP_TO_PHP_55,
// LevelSetList::UP_TO_PHP_56,
// LevelSetList::UP_TO_PHP_70,
// LevelSetList::UP_TO_PHP_71,
// LevelSetList::UP_TO_PHP_72,
// LevelSetList::UP_TO_PHP_73,
// LevelSetList::UP_TO_PHP_74,
// LevelSetList::UP_TO_PHP_80,
// LevelSetList::UP_TO_PHP_81,
// LevelSetList::UP_TO_PHP_82,
// LevelSetList::UP_TO_PHP_83,
// SetList::CODE_QUALITY,
// SetList::CODING_STYLE,
// SetList::DEAD_CODE,
// SetList::EARLY_RETURN,
// SetList::INSTANCEOF,
// SetList::NAMING,
// SetList::PRIVATIZATION,
// SetList::STRICT_BOOLEANS,
// SetList::TYPE_DECLARATION,
// PHPUnit sets
// PHPUnitSetList::PHPUNIT80_DMS,
// PHPUnitSetList::PHPUNIT_40,
// PHPUnitSetList::PHPUNIT_50,
// PHPUnitSetList::PHPUNIT_60,
// PHPUnitSetList::PHPUNIT_70,
// PHPUnitSetList::PHPUNIT_80,
// PHPUnitSetList::PHPUNIT_90,
// PHPUnitSetList::PHPUNIT_100,
// PHPUnitSetList::PHPUNIT_CODE_QUALITY,
// TYPO3 Sets
// https://github.com/sabbelasichon/typo3-rector/blob/main/src/Set/Typo3LevelSetList.php
// https://github.com/sabbelasichon/typo3-rector/blob/main/src/Set/Typo3SetList.php
Typo3SetList::CODE_QUALITY,
Typo3SetList::GENERAL,
Typo3LevelSetList::UP_TO_TYPO3_11,
// Typo3LevelSetList::UP_TO_TYPO3_12,
// TYPO3TestingFrameworkSetList::TYPO3_TESTING_FRAMEWORK_7,
])
// To have a better analysis from PHPStan, we teach it here some more things
->withPHPStanConfigs([
Typo3Option::PHPSTAN_FOR_RECTOR_PATH,
])
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
ConvertImplicitVariablesToExplicitGlobalsRector::class,
])
->withImportNames(true, true, false)
->withConfiguredRule(ExtEmConfRector::class, [
ExtEmConfRector::PHP_VERSION_CONSTRAINT => '7.4.0-8.3.99',
ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '11.5.40-11.5.99',
ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [],
])
->withSkip([
]);