4986 |
kaklik |
1 |
<?php |
|
|
2 |
|
|
|
3 |
declare(strict_types=1); |
|
|
4 |
|
|
|
5 |
use Rector\Config\RectorConfig; |
4987 |
kaklik |
6 |
use Rector\Set\ValueObject\SetList; |
4986 |
kaklik |
7 |
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector; |
|
|
8 |
|
4987 |
kaklik |
9 |
return static function (RectorConfig $rectorConfig): void { |
|
|
10 |
$rectorConfig->paths([ |
4986 |
kaklik |
11 |
__DIR__ . '/Articles', |
|
|
12 |
__DIR__ . '/Server', |
|
|
13 |
__DIR__ . '/Web', |
4987 |
kaklik |
14 |
]); |
|
|
15 |
|
|
|
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 |
|
|
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) |
|
|
36 |
$rectorConfig->rules([ |
4986 |
kaklik |
37 |
AddVoidReturnTypeWhereNoReturnRector::class, |
|
|
38 |
]); |
4987 |
kaklik |
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 |
}; |