-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrector.php
More file actions
executable file
·68 lines (61 loc) · 2.64 KB
/
rector.php
File metadata and controls
executable file
·68 lines (61 loc) · 2.64 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
62
63
64
65
66
67
68
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withSkip([
// Exclude vendor, build artifacts, caches, and dynamic/generated files
__DIR__ . '/vendor',
__DIR__ . '/build',
__DIR__ . '/storage/cache',
__DIR__ . '/storage/logs',
__DIR__ . '/storage/ratelimits',
// Skip magic/dynamic areas where property promotion might break things
__DIR__ . '/src/Container', // Dependency injection container might rely on dynamic properties
__DIR__ . '/src/Models/BaseModel.php', // ORM-like models might use __set/__get
// Skip specific transformations that might be risky for library code
ClassPropertyAssignToConstructorPromotionRector::class => [
__DIR__ . '/src/Http/Request.php', // Request handling might need explicit properties
__DIR__ . '/src/Http/Response.php', // Response handling might need explicit properties
__DIR__ . '/src/Models', // Model classes might be extended by users
],
StringClassNameToClassConstantRector::class,
RemoveEmptyClassMethodRector::class => [
__DIR__ . '/tests/ContainerTest.php',
],
RemoveUnusedPromotedPropertyRector::class => [
__DIR__ . '/tests/ContainerTest.php',
],
RemoveParentCallWithoutParentRector::class => [
__DIR__ . '/src/Database/Relations', // Keep model instance static method calls
],
])
->withSets([
// Core language modernization to PHP 8.4
LevelSetList::UP_TO_PHP_84,
// Quality improvements that are safe for libraries
SetList::CODE_QUALITY,
SetList::TYPE_DECLARATION,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::CODING_STYLE,
])
->withImportNames(
importShortClasses: true,
removeUnusedImports: true
)
->withParallel()
->withCache(__DIR__ . '/var/cache/rector')
->withPhpSets(php84: true);