Line 1... |
Line 1... |
1 |
<?php |
1 |
<?php |
2 |
|
2 |
|
3 |
declare(strict_types=1); |
3 |
declare(strict_types=1); |
4 |
|
4 |
|
5 |
use Rector\Config\RectorConfig; |
5 |
use Rector\Config\RectorConfig; |
- |
|
6 |
use Rector\Set\ValueObject\SetList; |
6 |
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector; |
7 |
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector; |
7 |
|
8 |
|
8 |
return RectorConfig::configure() |
9 |
return static function (RectorConfig $rectorConfig): void { |
9 |
->withPaths([ |
10 |
$rectorConfig->paths([ |
10 |
__DIR__ . '/Articles', |
11 |
__DIR__ . '/Articles', |
11 |
__DIR__ . '/Server', |
12 |
__DIR__ . '/Server', |
12 |
__DIR__ . '/Web', |
13 |
__DIR__ . '/Web', |
13 |
]) |
14 |
]); |
- |
|
15 |
|
14 |
// uncomment to reach your current PHP version |
16 |
// Uncomment and set this to your target PHP version |
- |
|
17 |
$rectorConfig->phpVersion(PHP_VERSION_ID); // for PHP 8, this might be 80000 for 8.0 |
- |
|
18 |
|
- |
|
19 |
// Include sets of rules for PHP version upgrades |
- |
|
20 |
// For upgrading to PHP 8.0 |
15 |
// ->withPhpSets() |
21 |
$rectorConfig->sets([ |
- |
|
22 |
SetList::PHP_80, |
- |
|
23 |
]); |
- |
|
24 |
|
- |
|
25 |
// Optionally, include PHP 7.x sets if upgrading from PHP 5 |
- |
|
26 |
$rectorConfig->sets([ |
- |
|
27 |
SetList::PHP_70, |
- |
|
28 |
SetList::PHP_71, |
- |
|
29 |
SetList::PHP_72, |
- |
|
30 |
SetList::PHP_73, |
- |
|
31 |
SetList::PHP_74, |
- |
|
32 |
SetList::PHP_80, // Ensure this is the last to apply PHP 8 changes |
- |
|
33 |
]); |
- |
|
34 |
|
- |
|
35 |
// Custom rules (you can keep this if you need specific rules like the one below) |
16 |
->withRules([ |
36 |
$rectorConfig->rules([ |
17 |
AddVoidReturnTypeWhereNoReturnRector::class, |
37 |
AddVoidReturnTypeWhereNoReturnRector::class, |
18 |
]); |
38 |
]); |
- |
|
39 |
|
- |
|
40 |
// Uncomment and adjust to your current PHP version |
- |
|
41 |
// This helps Rector make decisions based on your starting PHP version. |
- |
|
42 |
// $rectorConfig->phpVersion(70400); // Example for PHP 7.4 |
- |
|
43 |
}; |