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