-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathdowngrade-php80.php
More file actions
95 lines (88 loc) · 5.23 KB
/
downgrade-php80.php
File metadata and controls
95 lines (88 loc) · 5.23 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
declare(strict_types=1);
use Rector\DowngradePhp80\Rector\ClassMethod\RemoveReturnTypeDeclarationFromCloneRector;
use Rector\Config\RectorConfig;
use Rector\ValueObject\PhpVersion;
use Rector\DowngradePhp80\Rector\ArrayDimFetch\DowngradeDereferenceableOperationRector;
use Rector\DowngradePhp80\Rector\Catch_\DowngradeNonCapturingCatchesRector;
use Rector\DowngradePhp80\Rector\Class_\DowngradeAttributeToAnnotationRector;
use Rector\DowngradePhp80\Rector\Class_\DowngradePropertyPromotionRector;
use Rector\DowngradePhp80\Rector\ClassConstFetch\DowngradeClassOnObjectToGetClassRector;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeAbstractPrivateMethodInTraitRector;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeRecursiveDirectoryIteratorHasChildrenRector;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStaticTypeDeclarationRector;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeStringReturnTypeOnToStringRector;
use Rector\DowngradePhp80\Rector\ClassMethod\DowngradeTrailingCommasInParamUseRector;
use Rector\DowngradePhp80\Rector\Enum_\DowngradeEnumToConstantListClassRector;
use Rector\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector;
use Rector\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeArrayFilterNullableCallbackRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeNumberFormatNoFourthArgRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrContainsRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrEndsWithRector;
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrStartsWithRector;
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector;
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector;
use Rector\DowngradePhp80\Rector\Instanceof_\DowngradeInstanceofStringableRector;
use Rector\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector;
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeNamedArgumentRector;
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionClassGetConstantsFilterRector;
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionGetAttributesRector;
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector;
use Rector\DowngradePhp80\Rector\New_\DowngradeArbitraryExpressionsSupportRector;
use Rector\DowngradePhp80\Rector\NullsafeMethodCall\DowngradeNullsafeToTernaryOperatorRector;
use Rector\DowngradePhp80\Rector\Property\DowngradeMixedTypeTypedPropertyRector;
use Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector;
use Rector\DowngradePhp80\Rector\StaticCall\DowngradePhpTokenRector;
use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
use Rector\Removing\Rector\Class_\RemoveInterfacesRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_74);
$rectorConfig
->ruleWithConfiguration(RemoveInterfacesRector::class, [
// @see https://wiki.php.net/rfc/stringable
'Stringable',
]);
$rectorConfig
->ruleWithConfiguration(DowngradeAttributeToAnnotationRector::class, [
// Symfony
new DowngradeAttributeToAnnotation('Symfony\Contracts\Service\Attribute\Required', 'required'),
// Nette
new DowngradeAttributeToAnnotation('Nette\DI\Attributes\Inject', 'inject'),
// Jetbrains\PhpStorm\Language under nette/utils
new DowngradeAttributeToAnnotation('Jetbrains\PhpStorm\Language', 'language'),
]);
$rectorConfig->rules([
DowngradeNamedArgumentRector::class,
DowngradeDereferenceableOperationRector::class,
DowngradeUnionTypeTypedPropertyRector::class,
DowngradeUnionTypeDeclarationRector::class,
DowngradeMixedTypeDeclarationRector::class,
DowngradeStaticTypeDeclarationRector::class,
DowngradeAbstractPrivateMethodInTraitRector::class,
DowngradePropertyPromotionRector::class,
DowngradeNonCapturingCatchesRector::class,
DowngradeStrContainsRector::class,
DowngradeMatchToSwitchRector::class,
DowngradeClassOnObjectToGetClassRector::class,
DowngradeArbitraryExpressionsSupportRector::class,
DowngradeNullsafeToTernaryOperatorRector::class,
DowngradeTrailingCommasInParamUseRector::class,
DowngradeStrStartsWithRector::class,
DowngradeStrEndsWithRector::class,
DowngradePhpTokenRector::class,
DowngradeThrowExprRector::class,
DowngradePhp80ResourceReturnToObjectRector::class,
DowngradeReflectionGetAttributesRector::class,
DowngradeRecursiveDirectoryIteratorHasChildrenRector::class,
DowngradeReflectionPropertyGetDefaultValueRector::class,
DowngradeReflectionClassGetConstantsFilterRector::class,
DowngradeArrayFilterNullableCallbackRector::class,
DowngradeNumberFormatNoFourthArgRector::class,
DowngradeStringReturnTypeOnToStringRector::class,
DowngradeMixedTypeTypedPropertyRector::class,
RemoveReturnTypeDeclarationFromCloneRector::class,
DowngradeEnumToConstantListClassRector::class,
DowngradeInstanceofStringableRector::class,
]);
};