-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
61 lines (50 loc) · 1.98 KB
/
rector.php
File metadata and controls
61 lines (50 loc) · 1.98 KB
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
<?php
/**
* Rector configuration for TYPO3 v14 extension upgrade
*
* Usage:
* ./vendor/bin/rector process --dry-run # Preview changes
* ./vendor/bin/rector process # Apply changes
*
* Requires: composer require --dev ssch/typo3-rector:^3.11
*/
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\PostRector\Rector\NameImportingPostRector;
use Rector\Set\ValueObject\LevelSetList;
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;
use Ssch\TYPO3Rector\Set\Typo3SetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/Classes',
__DIR__ . '/Configuration',
__DIR__ . '/ext_localconf.php',
]);
$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
$rectorConfig->removeUnusedImports();
// Define what rule sets will be applied
$rectorConfig->sets([
// PHP level upgrades (TYPO3 v14 minimum is PHP 8.2)
LevelSetList::UP_TO_PHP_82,
// v13+v14 dual compatibility: use v13 rules only
Typo3LevelSetList::UP_TO_TYPO3_13,
// TYPO3 code quality and general improvements
Typo3SetList::CODE_QUALITY,
Typo3SetList::GENERAL,
]);
$rectorConfig->skip([
__DIR__ . '/ext_emconf.php',
__DIR__ . '/.Build',
__DIR__ . '/vendor',
// Skip constructor promotion - keep explicit property declarations for clarity
ClassPropertyAssignToConstructorPromotionRector::class,
// Skip removing parent calls - may be needed for TYPO3 hooks
RemoveParentCallWithoutParentRector::class,
// Don't import names in ext_localconf.php — conditionally-loaded classes
// (e.g. Solr) must stay as FQCN inside isLoaded() guards
NameImportingPostRector::class => [__DIR__ . '/ext_localconf.php'],
]);
};