-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrector-downgrade.php
48 lines (41 loc) · 2.08 KB
/
rector-downgrade.php
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
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) 2023 CodeIgniter Foundation <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use Rector\Config\RectorConfig;
use Rector\DowngradePhp80\Rector\Catch_\DowngradeNonCapturingCatchesRector;
use Rector\DowngradePhp80\Rector\Class_\DowngradePropertyPromotionRector;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
use Rector\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector;
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector;
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector;
use Rector\DowngradePhp80\Rector\NullsafeMethodCall\DowngradeNullsafeToTernaryOperatorRector;
use Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector;
use Rector\DowngradePhp81\Rector\FunctionLike\DowngradePureIntersectionTypeRector;
use Rector\DowngradePhp81\Rector\Property\DowngradeReadonlyPropertyRector;
return static function (RectorConfig $config): void {
$targetPhpVersionId = (int) getenv('TARGET_PHP_VERSION_ID');
$config->paths([__DIR__ . '/../src']);
$config->phpVersion($targetPhpVersionId);
$config->disableParallel();
if ($targetPhpVersionId < 80100) {
$config->rule(DowngradePureIntersectionTypeRector::class);
$config->rule(DowngradeReadonlyPropertyRector::class);
}
if ($targetPhpVersionId < 80000) {
$config->rule(DowngradeMatchToSwitchRector::class);
$config->rule(DowngradeMixedTypeDeclarationRector::class);
$config->rule(DowngradeNonCapturingCatchesRector::class);
$config->rule(DowngradeNullsafeToTernaryOperatorRector::class);
$config->rule(DowngradePropertyPromotionRector::class);
$config->rule(DowngradeTrailingCommasInParamUseRector::class);
$config->rule(DowngradeUnionTypeDeclarationRector::class);
$config->rule(DowngradeUnionTypeTypedPropertyRector::class);
}
};