Use rector downgrade php (#2582)

* Require rector-downgrade-php

* test

* update

* temporary require rector/rector-downgrade-php on package test

* tweak

* easy-ci fix

* fix

* try with remove --no-update

* Revert try with remove --no-update

This reverts commit 2257be6237718a68d8d28ae565abf24bd6abf36b.

* regenerate docs

* try tweak
This commit is contained in:
Abdul Malik Ikhsan 2022-06-28 19:35:58 +07:00 committed by GitHub
parent 92621698c2
commit e97dd8f360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1089 changed files with 25 additions and 42135 deletions

View File

@ -28,6 +28,7 @@ jobs:
- rectorphp/rector-nette
- rectorphp/rector-cakephp
- rectorphp/rector-phpoffice
- rectorphp/rector-downgrade-php
steps:
# see https://github.com/actions/checkout#usage
@ -48,7 +49,11 @@ jobs:
# test with current commit in a pull-request
-
run: composer require rector/rector-src dev-main#${{github.event.pull_request.head.sha}} --no-update
if: ${{ github.event_name == 'pull_request' }}
if: ${{ github.event_name == 'pull_request' && matrix.repository_name != 'rectorphp/rector-downgrade-php' }}
-
run: composer require rector/rector-downgrade-php:dev-main --no-update
if: ${{ matrix.repository_name != 'rectorphp/rector-downgrade-php' }}
- run: composer install --ansi

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
"rector/extension-installer": "^0.11.2",
"rector/rector-cakephp": "dev-main",
"rector/rector-doctrine": "dev-main",
"rector/rector-downgrade-php": "dev-main",
"rector/rector-generator": "dev-main",
"rector/rector-laravel": "dev-main",
"rector/rector-nette": "dev-main",

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp53\Rector\Dir\DirConstToFileConstRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_52);
$rectorConfig->rule(DirConstToFileConstRector::class);
};

View File

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector;
use Rector\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector;
use Rector\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector;
use Rector\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector;
use Rector\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector;
use Rector\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector;
use Rector\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_53);
$rectorConfig->rule(ShortArrayToLongArrayRector::class);
$rectorConfig->rule(DowngradeStaticClosureRector::class);
$rectorConfig->rule(DowngradeIndirectCallByArrayRector::class);
$rectorConfig->rule(DowngradeCallableTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeBinaryNotationRector::class);
$rectorConfig->rule(DowngradeInstanceMethodCallRector::class);
$rectorConfig->rule(DowngradeThisInClosureRector::class);
};

View File

@ -1,18 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector;
use Rector\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector;
use Rector\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector;
use Rector\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_54);
$rectorConfig->rule(DowngradeClassConstantToStringRector::class);
$rectorConfig->rule(DowngradeForeachListRector::class);
$rectorConfig->rule(DowngradeBoolvalRector::class);
$rectorConfig->rule(DowngradeArbitraryExpressionArgsToEmptyAndIssetRector::class);
};

View File

@ -1,20 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector;
use Rector\DowngradePhp56\Rector\FuncCall\DowngradeArrayFilterUseConstantRector;
use Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialAssignmentOperatorRector;
use Rector\DowngradePhp56\Rector\Pow\DowngradeExponentialOperatorRector;
use Rector\DowngradePhp56\Rector\Use_\DowngradeUseFunctionRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_55);
$rectorConfig->rule(DowngradeArgumentUnpackingRector::class);
$rectorConfig->rule(DowngradeUseFunctionRector::class);
$rectorConfig->rule(DowngradeExponentialAssignmentOperatorRector::class);
$rectorConfig->rule(DowngradeExponentialOperatorRector::class);
$rectorConfig->rule(DowngradeArrayFilterUseConstantRector::class);
};

View File

@ -1,46 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp70\Rector\ClassMethod\DowngradeParentTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\ClassMethod\DowngradeSelfTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\Coalesce\DowngradeNullCoalesceRector;
use Rector\DowngradePhp70\Rector\Declare_\DowngradeStrictTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\Expr\DowngradeUnnecessarilyParenthesizedExpressionRector;
use Rector\DowngradePhp70\Rector\Expression\DowngradeDefineArrayConstantRector;
use Rector\DowngradePhp70\Rector\FuncCall\DowngradeDirnameLevelsRector;
use Rector\DowngradePhp70\Rector\FuncCall\DowngradeSessionStartArrayOptionsRector;
use Rector\DowngradePhp70\Rector\FuncCall\DowngradeUncallableValueCallToCallUserFuncRector;
use Rector\DowngradePhp70\Rector\FunctionLike\DowngradeScalarTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\FunctionLike\DowngradeThrowableTypeDeclarationRector;
use Rector\DowngradePhp70\Rector\GroupUse\SplitGroupedUseImportsRector;
use Rector\DowngradePhp70\Rector\Instanceof_\DowngradeInstanceofThrowableRector;
use Rector\DowngradePhp70\Rector\MethodCall\DowngradeClosureCallRector;
use Rector\DowngradePhp70\Rector\MethodCall\DowngradeMethodCallOnCloneRector;
use Rector\DowngradePhp70\Rector\New_\DowngradeAnonymousClassRector;
use Rector\DowngradePhp70\Rector\Spaceship\DowngradeSpaceshipRector;
use Rector\DowngradePhp70\Rector\TryCatch\DowngradeCatchThrowableRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_56);
$rectorConfig->rule(DowngradeCatchThrowableRector::class);
$rectorConfig->rule(DowngradeInstanceofThrowableRector::class);
$rectorConfig->rule(DowngradeScalarTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeThrowableTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeStrictTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeSelfTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeAnonymousClassRector::class);
$rectorConfig->rule(DowngradeNullCoalesceRector::class);
$rectorConfig->rule(DowngradeSpaceshipRector::class);
$rectorConfig->rule(DowngradeDefineArrayConstantRector::class);
$rectorConfig->rule(DowngradeDirnameLevelsRector::class);
$rectorConfig->rule(DowngradeSessionStartArrayOptionsRector::class);
$rectorConfig->rule(DowngradeUncallableValueCallToCallUserFuncRector::class);
$rectorConfig->rule(SplitGroupedUseImportsRector::class);
$rectorConfig->rule(DowngradeClosureCallRector::class);
$rectorConfig->rule(DowngradeParentTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeMethodCallOnCloneRector::class);
$rectorConfig->rule(DowngradeUnnecessarilyParenthesizedExpressionRector::class);
};

View File

@ -1,32 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp71\Rector\Array_\SymmetricArrayDestructuringToListRector;
use Rector\DowngradePhp71\Rector\ClassConst\DowngradeClassConstantVisibilityRector;
use Rector\DowngradePhp71\Rector\ConstFetch\DowngradePhp71JsonConstRector;
use Rector\DowngradePhp71\Rector\FuncCall\DowngradeIsIterableRector;
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeIterablePseudoTypeDeclarationRector;
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeNullableTypeDeclarationRector;
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeVoidTypeDeclarationRector;
use Rector\DowngradePhp71\Rector\List_\DowngradeKeysInListRector;
use Rector\DowngradePhp71\Rector\StaticCall\DowngradeClosureFromCallableRector;
use Rector\DowngradePhp71\Rector\String_\DowngradeNegativeStringOffsetToStrlenRector;
use Rector\DowngradePhp71\Rector\TryCatch\DowngradePipeToMultiCatchExceptionRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_70);
$rectorConfig->rule(DowngradeNullableTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeVoidTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeClassConstantVisibilityRector::class);
$rectorConfig->rule(DowngradePipeToMultiCatchExceptionRector::class);
$rectorConfig->rule(SymmetricArrayDestructuringToListRector::class);
$rectorConfig->rule(DowngradeNegativeStringOffsetToStrlenRector::class);
$rectorConfig->rule(DowngradeKeysInListRector::class);
$rectorConfig->rule(DowngradeIterablePseudoTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeIsIterableRector::class);
$rectorConfig->rule(DowngradeClosureFromCallableRector::class);
$rectorConfig->rule(DowngradePhp71JsonConstRector::class);
};

View File

@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector;
use Rector\DowngradePhp72\Rector\ConstFetch\DowngradePhp72JsonConstRector;
use Rector\DowngradePhp72\Rector\FuncCall\DowngradeJsonDecodeNullAssociativeArgRector;
use Rector\DowngradePhp72\Rector\FuncCall\DowngradePregUnmatchedAsNullConstantRector;
use Rector\DowngradePhp72\Rector\FuncCall\DowngradeStreamIsattyRector;
use Rector\DowngradePhp72\Rector\FunctionLike\DowngradeObjectTypeDeclarationRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_71);
$rectorConfig->rule(DowngradeObjectTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeParameterTypeWideningRector::class);
$rectorConfig->rule(DowngradePregUnmatchedAsNullConstantRector::class);
$rectorConfig->rule(DowngradeStreamIsattyRector::class);
$rectorConfig->rule(DowngradeJsonDecodeNullAssociativeArgRector::class);
$rectorConfig->rule(DowngradePhp72JsonConstRector::class);
};

View File

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp73\Rector\ConstFetch\DowngradePhp73JsonConstRector;
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeArrayKeyFirstLastRector;
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeIsCountableRector;
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCallsRector;
use Rector\DowngradePhp73\Rector\FuncCall\SetCookieOptionsArrayToArgumentsRector;
use Rector\DowngradePhp73\Rector\List_\DowngradeListReferenceAssignmentRector;
use Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_72);
$rectorConfig->rule(DowngradeFlexibleHeredocSyntaxRector::class);
$rectorConfig->rule(DowngradeListReferenceAssignmentRector::class);
$rectorConfig->rule(DowngradeTrailingCommasInFunctionCallsRector::class);
$rectorConfig->rule(DowngradeArrayKeyFirstLastRector::class);
$rectorConfig->rule(SetCookieOptionsArrayToArgumentsRector::class);
$rectorConfig->rule(DowngradeIsCountableRector::class);
$rectorConfig->rule(DowngradePhp73JsonConstRector::class);
};

View File

@ -1,34 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector;
use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeRector;
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector;
use Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector;
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector;
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeStripTagsCallWithArrayRector;
use Rector\DowngradePhp74\Rector\Identical\DowngradeFreadFwriteFalsyToNegationRector;
use Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector;
use Rector\DowngradePhp74\Rector\LNumber\DowngradeNumericLiteralSeparatorRector;
use Rector\DowngradePhp74\Rector\MethodCall\DowngradeReflectionGetTypeRector;
use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_73);
$rectorConfig->rule(DowngradeTypedPropertyRector::class);
$rectorConfig->rule(ArrowFunctionToAnonymousFunctionRector::class);
$rectorConfig->rule(DowngradeCovariantReturnTypeRector::class);
$rectorConfig->rule(DowngradeContravariantArgumentTypeRector::class);
$rectorConfig->rule(DowngradeNullCoalescingOperatorRector::class);
$rectorConfig->rule(DowngradeNumericLiteralSeparatorRector::class);
$rectorConfig->rule(DowngradeStripTagsCallWithArrayRector::class);
$rectorConfig->rule(DowngradeArraySpreadRector::class);
$rectorConfig->rule(DowngradeArrayMergeCallWithoutArgumentsRector::class);
$rectorConfig->rule(DowngradeFreadFwriteFalsyToNegationRector::class);
$rectorConfig->rule(DowngradePreviouslyImplementedInterfaceRector::class);
$rectorConfig->rule(DowngradeReflectionGetTypeRector::class);
};

View File

@ -1,84 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\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\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_\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->rule(DowngradeNamedArgumentRector::class);
$rectorConfig
->ruleWithConfiguration(DowngradeAttributeToAnnotationRector::class, [
// Symfony
new DowngradeAttributeToAnnotation('Symfony\Contracts\Service\Attribute\Required', 'required'),
// Nette
new DowngradeAttributeToAnnotation('Nette\DI\Attributes\Inject', 'inject'),
]);
$rectorConfig->rule(DowngradeDereferenceableOperationRector::class);
$rectorConfig->rule(DowngradeUnionTypeTypedPropertyRector::class);
$rectorConfig->rule(DowngradeUnionTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeMixedTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeStaticTypeDeclarationRector::class);
$rectorConfig->rule(DowngradeAbstractPrivateMethodInTraitRector::class);
$rectorConfig->rule(DowngradePropertyPromotionRector::class);
$rectorConfig->rule(DowngradeNonCapturingCatchesRector::class);
$rectorConfig->rule(DowngradeStrContainsRector::class);
$rectorConfig->rule(DowngradeMatchToSwitchRector::class);
$rectorConfig->rule(DowngradeClassOnObjectToGetClassRector::class);
$rectorConfig->rule(DowngradeArbitraryExpressionsSupportRector::class);
$rectorConfig->rule(DowngradeNullsafeToTernaryOperatorRector::class);
$rectorConfig->rule(DowngradeTrailingCommasInParamUseRector::class);
$rectorConfig->rule(DowngradeStrStartsWithRector::class);
$rectorConfig->rule(DowngradeStrEndsWithRector::class);
$rectorConfig->rule(DowngradePhpTokenRector::class);
$rectorConfig->rule(DowngradeThrowExprRector::class);
$rectorConfig->rule(DowngradePhp80ResourceReturnToObjectRector::class);
$rectorConfig->rule(DowngradeReflectionGetAttributesRector::class);
$rectorConfig->rule(DowngradeRecursiveDirectoryIteratorHasChildrenRector::class);
$rectorConfig->rule(DowngradeReflectionPropertyGetDefaultValueRector::class);
$rectorConfig->rule(DowngradeReflectionClassGetConstantsFilterRector::class);
$rectorConfig->rule(DowngradeArrayFilterNullableCallbackRector::class);
$rectorConfig->rule(DowngradeNumberFormatNoFourthArgRector::class);
$rectorConfig->rule(DowngradeStringReturnTypeOnToStringRector::class);
$rectorConfig->rule(DowngradeMixedTypeTypedPropertyRector::class);
};

View File

@ -1,28 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp81\Rector\Array_\DowngradeArraySpreadStringKeyRector;
use Rector\DowngradePhp81\Rector\ClassConst\DowngradeFinalizePublicClassConstantRector;
use Rector\DowngradePhp81\Rector\FuncCall\DowngradeArrayIsListRector;
use Rector\DowngradePhp81\Rector\FuncCall\DowngradeFirstClassCallableSyntaxRector;
use Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNeverTypeDeclarationRector;
use Rector\DowngradePhp81\Rector\FunctionLike\DowngradeNewInInitializerRector;
use Rector\DowngradePhp81\Rector\FunctionLike\DowngradePureIntersectionTypeRector;
use Rector\DowngradePhp81\Rector\Instanceof_\DowngradePhp81ResourceReturnToObjectRector;
use Rector\DowngradePhp81\Rector\Property\DowngradeReadonlyPropertyRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_80);
$rectorConfig->rule(DowngradeFinalizePublicClassConstantRector::class);
$rectorConfig->rule(DowngradeFirstClassCallableSyntaxRector::class);
$rectorConfig->rule(DowngradeNeverTypeDeclarationRector::class);
$rectorConfig->rule(DowngradePureIntersectionTypeRector::class);
$rectorConfig->rule(DowngradeNewInInitializerRector::class);
$rectorConfig->rule(DowngradePhp81ResourceReturnToObjectRector::class);
$rectorConfig->rule(DowngradeReadonlyPropertyRector::class);
$rectorConfig->rule(DowngradeArraySpreadStringKeyRector::class);
$rectorConfig->rule(DowngradeArrayIsListRector::class);
};

View File

@ -1,12 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp82\Rector\Class_\DowngradeReadonlyClassRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_81);
$rectorConfig->rule(DowngradeReadonlyClassRector::class);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_53, DowngradeSetList::PHP_53]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_54, DowngradeSetList::PHP_54]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_55, DowngradeSetList::PHP_55]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_56, DowngradeSetList::PHP_56]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_70, DowngradeSetList::PHP_70]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_71, DowngradeSetList::PHP_71]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72, DowngradeSetList::PHP_72]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_73, DowngradeSetList::PHP_73]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_74, DowngradeSetList::PHP_74]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_80, DowngradeSetList::PHP_80]);
};

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeLevelSetList;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_81, DowngradeSetList::PHP_81]);
};

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\DowngradeSetList;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeSetList::PHP_82]);
};

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
use PHPStan\PhpDocParser\Parser\TypeParser;
use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface;
use Rector\CodeQuality\NodeTypeGroup;
use Rector\CodingStyle\Contract\ClassNameImport\ClassNameImportSkipVoterInterface;
use Rector\Core\Contract\Console\OutputStyleInterface;
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
@ -11,18 +12,25 @@ use Rector\Core\Contract\PHPStan\Reflection\TypeToCallReflectionResolver\TypeToC
use Rector\Core\Contract\Processor\FileProcessorInterface;
use Rector\Core\Contract\Rector\RectorInterface;
use Rector\Core\Contract\Template\TemplateResolverInterface;
use Rector\Core\NodeAnalyzer\CoalesceAnalyzer;
use Rector\Core\NodeDecorator\NamespacedNameDecorator;
use Rector\Core\NodeManipulator\MethodCallManipulator;
use Rector\Core\PhpParser\Node\NamedVariableFactory;
use Rector\Defluent\NodeAnalyzer\SameClassMethodCallAnalyzer;
use Rector\DependencyInjection\NodeManipulator\PropertyConstructorInjectionManipulator;
use Rector\FileSystemRector\Parser\FileInfoParser;
use Rector\Naming\Contract\AssignVariableNameResolverInterface;
use Rector\Naming\Contract\Guard\ConflictingNameGuardInterface;
use Rector\NodeCollector\BinaryOpTreeRootLocator;
use Rector\NodeNameResolver\Contract\NodeNameResolverInterface;
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use Rector\NodeTypeResolver\DependencyInjection\PHPStanServicesFactory;
use Rector\NodeTypeResolver\Reflection\BetterReflection\RectorBetterReflectionSourceLocatorFactory;
use Rector\NodeTypeResolver\TypeAnalyzer\MethodTypeAnalyzer;
use Rector\Php80\Contract\StrStartWithMatchAndRefactorInterface;
use Rector\Php81\NodeFactory\ClassFromEnumFactory;
use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface;
use Rector\PhpAttribute\NodeFactory\DoctrineAnnotationFactory;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
use Rector\ReadWrite\Contract\ParentNodeReadAnalyzerInterface;
use Rector\ReadWrite\Contract\ReadNodeAnalyzerInterface;
@ -77,8 +85,16 @@ return static function (ContainerConfigurator $containerConfigurator): void {
TypeWithClassTypeSpecifierInterface::class,
ParentNodeReadAnalyzerInterface::class,
StmtsAwareInterface::class,
\Rector\CodeQuality\NodeTypeGroup::class,
NodeTypeGroup::class,
// deprecated, keep it for now
TemplateResolverInterface::class,
MethodTypeAnalyzer::class,
DoctrineAnnotationFactory::class,
ClassFromEnumFactory::class,
CoalesceAnalyzer::class,
NamespacedNameDecorator::class,
NamedVariableFactory::class,
BinaryOpTreeRootLocator::class,
]);
};

View File

@ -1,70 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Set\ValueObject;
use Rector\Set\Contract\SetListInterface;
final class DowngradeLevelSetList implements SetListInterface
{
/**
* @var string
*/
public const DOWN_TO_PHP_81 = __DIR__ . '/../../../config/set/level/down-to-php81.php';
/**
* @var string
*/
public const DOWN_TO_PHP_80 = __DIR__ . '/../../../config/set/level/down-to-php80.php';
/**
* @var string
*/
public const DOWN_TO_PHP_74 = __DIR__ . '/../../../config/set/level/down-to-php74.php';
/**
* @var string
*/
public const DOWN_TO_PHP_73 = __DIR__ . '/../../../config/set/level/down-to-php73.php';
/**
* @var string
*/
public const DOWN_TO_PHP_72 = __DIR__ . '/../../../config/set/level/down-to-php72.php';
/**
* @var string
*/
public const DOWN_TO_PHP_71 = __DIR__ . '/../../../config/set/level/down-to-php71.php';
/**
* @var string
*/
public const DOWN_TO_PHP_70 = __DIR__ . '/../../../config/set/level/down-to-php70.php';
/**
* @var string
*/
public const DOWN_TO_PHP_56 = __DIR__ . '/../../../config/set/level/down-to-php56.php';
/**
* @var string
*/
public const DOWN_TO_PHP_55 = __DIR__ . '/../../../config/set/level/down-to-php55.php';
/**
* @var string
*/
public const DOWN_TO_PHP_54 = __DIR__ . '/../../../config/set/level/down-to-php54.php';
/**
* @var string
*/
public const DOWN_TO_PHP_53 = __DIR__ . '/../../../config/set/level/down-to-php53.php';
/**
* @var string
*/
public const DOWN_TO_PHP_52 = __DIR__ . '/../../../config/set/level/down-to-php52.php';
}

View File

@ -1,70 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Set\ValueObject;
use Rector\Set\Contract\SetListInterface;
final class DowngradeSetList implements SetListInterface
{
/**
* @var string
*/
public const PHP_53 = __DIR__ . '/../../../config/set/downgrade-php53.php';
/**
* @var string
*/
public const PHP_54 = __DIR__ . '/../../../config/set/downgrade-php54.php';
/**
* @var string
*/
public const PHP_55 = __DIR__ . '/../../../config/set/downgrade-php55.php';
/**
* @var string
*/
public const PHP_56 = __DIR__ . '/../../../config/set/downgrade-php56.php';
/**
* @var string
*/
public const PHP_70 = __DIR__ . '/../../../config/set/downgrade-php70.php';
/**
* @var string
*/
public const PHP_71 = __DIR__ . '/../../../config/set/downgrade-php71.php';
/**
* @var string
*/
public const PHP_72 = __DIR__ . '/../../../config/set/downgrade-php72.php';
/**
* @var string
*/
public const PHP_73 = __DIR__ . '/../../../config/set/downgrade-php73.php';
/**
* @var string
*/
public const PHP_74 = __DIR__ . '/../../../config/set/downgrade-php74.php';
/**
* @var string
*/
public const PHP_80 = __DIR__ . '/../../../config/set/downgrade-php80.php';
/**
* @var string
*/
public const PHP_81 = __DIR__ . '/../../../config/set/downgrade-php81.php';
/**
* @var string
*/
public const PHP_82 = __DIR__ . '/../../../config/set/downgrade-php82.php';
}

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp53\Rector\Dir\DirConstToFileConstRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DirConstToFileConstRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp53\Rector\Dir\DirConstToFileConstRector\Fixture;
final class SomeClass
{
public function run()
{
return __DIR__;
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp53\Rector\Dir\DirConstToFileConstRector\Fixture;
final class SomeClass
{
public function run()
{
return dirname(__FILE__);
}
}
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp53\Rector\Dir\DirConstToFileConstRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DirConstToFileConstRector::class);
};

View File

@ -1,31 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector\Fixture;
final class SomeClass
{
public function run()
{
$a = [[], [1, 2, 3], ['foo' => 'bar']];
return [$a];
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector\Fixture;
final class SomeClass
{
public function run()
{
$a = array(array(), array(1, 2, 3), array('foo' => 'bar'));
return array($a);
}
}
?>

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ShortArrayToLongArrayRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp54\Rector\Array_\ShortArrayToLongArrayRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(ShortArrayToLongArrayRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeStaticClosureRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,31 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector\Fixture;
final class Fixture
{
public function run()
{
return static function () {
return true;
};
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector\Fixture;
final class Fixture
{
public function run()
{
return function () {
return true;
};
}
}
?>

View File

@ -1,13 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector\Fixture;
final class SkipNonStatic
{
public function run()
{
return function () {
return true;
};
}
}

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp54\Rector\Closure\DowngradeStaticClosureRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeStaticClosureRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeThisInClosureRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,46 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class DeepClosure
{
public $property = 'test';
public function run()
{
$function = function () {
$f = function () {
echo $this->property;
};
$f();
};
$function();
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class DeepClosure
{
public $property = 'test';
public function run()
{
$self = $this;
$function = function () use($self) {
$f = function () use($self) {
echo $self->property;
};
$f();
};
$function();
}
}
?>

View File

@ -1,40 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class Fixture
{
public $property = 'test';
public function run()
{
$function = function () {
echo $this->property;
};
$function();
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class Fixture
{
public $property = 'test';
public function run()
{
$self = $this;
$function = function () use($self) {
echo $self->property;
};
$function();
}
}
?>

View File

@ -1,42 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class SelfVariableExists
{
public $property = 'test';
public function run()
{
$self = 'test';
$function = function () {
echo $this->property;
};
$function();
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class SelfVariableExists
{
public $property = 'test';
public function run()
{
$self = 'test';
$self2 = $this;
$function = function () use($self2) {
echo $self2->property;
};
$function();
}
}
?>

View File

@ -1,22 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class SkipInAnonymousClass
{
public $property = 'test';
public function run()
{
$function = function () {
new class {
public function test()
{
echo $this->property;
}
};
};
$function();
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector\Fixture;
class SkipPrivateProperty
{
private $property = 'test';
public function run()
{
$function = function () {
echo $this->property;
};
$function();
}
}

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp54\Rector\Closure\DowngradeThisInClosureRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeThisInClosureRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeIndirectCallByArrayRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,8 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector\Fixture;
$func = 'strtoupper';
echo $func('hello'); // not supposed to change
?>

View File

@ -1,31 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector\Fixture;
final class SomeClass
{
public static function run($msg) {
echo "$msg\n";
}
}
$func = array('SomeClass','run');
$func('hello');
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector\Fixture;
final class SomeClass
{
public static function run($msg) {
echo "$msg\n";
}
}
$func = array('SomeClass','run');
call_user_func($func, 'hello');
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp54\Rector\FuncCall\DowngradeIndirectCallByArrayRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeIndirectCallByArrayRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeCallableTypeDeclarationRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector\Fixture;
final class SomeClass
{
public function run(callable $callback)
{
return $callback();
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector\Fixture;
final class SomeClass
{
/**
* @param callable $callback
*/
public function run($callback)
{
return $callback();
}
}
?>

View File

@ -1,24 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector\Fixture;
function run(callable $callback)
{
return $callback();
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector\Fixture;
/**
* @param callable $callback
*/
function run($callback)
{
return $callback();
}
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp54\Rector\FunctionLike\DowngradeCallableTypeDeclarationRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeCallableTypeDeclarationRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeBinaryNotationRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector\Fixture;
final class SomeClass
{
public function run()
{
return 0b11111100101 + 0B01;
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector\Fixture;
final class SomeClass
{
public function run()
{
return 2021 + 1;
}
}
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp54\Rector\LNumber\DowngradeBinaryNotationRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeBinaryNotationRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeInstanceMethodCallRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
return (clone (new \SplFixedArray(1)))[0];
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
$object = clone (new \SplFixedArray(1));
return $object[0];
}
}
?>

View File

@ -1,38 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function getName()
{
return 'foo';
}
public function run()
{
return (clone $this)->getName();
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function getName()
{
return 'foo';
}
public function run()
{
$object = clone $this;
return $object->getName();
}
}
?>

View File

@ -1,32 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public $name = 'foo';
public function run()
{
return (clone $this)->name;
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public $name = 'foo';
public function run()
{
$object = clone $this;
return $object->name;
}
}
?>

View File

@ -1,28 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
return (new \SplFixedArray(1))[0];
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
$object = new \SplFixedArray(1);
return $object[0];
}
}
?>

View File

@ -1,28 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
return (new \ReflectionClass('\\stdClass'))->getName();
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
$object = new \ReflectionClass('\\stdClass');
return $object->getName();
}
}
?>

View File

@ -1,28 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
return (new \ReflectionClass('\\stdClass'))->name;
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector\Fixture;
final class SomeClass
{
public function run()
{
$object = new \ReflectionClass('\\stdClass');
return $object->name;
}
}
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp54\Rector\MethodCall\DowngradeInstanceMethodCallRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeInstanceMethodCallRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeClassConstantToStringRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,43 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector\Fixture;
abstract class AnotherClass
{
public function run()
{
return self::class . '/' . static::class;
}
}
final class ChildClass extends AnotherClass
{
public function run()
{
return parent::Class;
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector\Fixture;
abstract class AnotherClass
{
public function run()
{
return get_class() . '/' . get_called_class();
}
}
final class ChildClass extends AnotherClass
{
public function run()
{
return get_parent_class();
}
}
?>

View File

@ -1,23 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector\Fixture;
final class SomeClass
{
}
echo SomeClass::class;
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector\Fixture;
final class SomeClass
{
}
echo 'Rector\Tests\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector\Fixture\SomeClass';
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp55\Rector\ClassConstFetch\DowngradeClassConstantToStringRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeClassConstantToStringRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeForeachListRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,32 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector\Fixture;
final class SomeClass
{
public function run(array $array)
{
foreach ($array as $key => list($item1, $item2)) {
var_dump($item1, $item2);
}
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector\Fixture;
final class SomeClass
{
public function run(array $array)
{
foreach ($array as $key => $arrayItem) {
list($item1, $item2) = $arrayItem;
var_dump($item1, $item2);
}
}
}
?>

View File

@ -1,34 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector\Fixture;
final class SomeClass
{
public function run(array $array)
{
$arrayItem = ['foo'];
foreach ($array as list($item1, $item2)) {
var_dump($item1, $item2);
}
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector\Fixture;
final class SomeClass
{
public function run(array $array)
{
$arrayItem = ['foo'];
foreach ($array as $arrayItem2) {
list($item1, $item2) = $arrayItem2;
var_dump($item1, $item2);
}
}
}
?>

View File

@ -1,15 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector\Fixture;
final class SomeClass
{
public function run(array $array)
{
foreach ($array as $key => $item) {
var_dump($item);
}
}
}
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp55\Rector\Foreach_\DowngradeForeachListRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeForeachListRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeBoolvalRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector\Fixture;
/**
* @param mixed $value
* @return bool
*/
function toBool($value)
{
return boolval($value);
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector\Fixture;
/**
* @param mixed $value
* @return bool
*/
function toBool($value)
{
return (bool) $value;
}
?>

View File

@ -1,23 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector\Fixture;
function mapToBool(array $values)
{
return array_map('boolval', $values);
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector\Fixture;
function mapToBool(array $values)
{
return array_map(function ($value) {
return (bool) $value;
}, $values);
}
?>

View File

@ -1,7 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector\Fixture;
var_dump(function_exists('boolval'));
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp55\Rector\FuncCall\DowngradeBoolvalRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeBoolvalRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeArbitraryExpressionArgsToEmptyAndIssetRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return empty(some_function()) && empty($var);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return !some_function() && empty($var);
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return empty(['a']);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return !['a'];
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return empty(1 + 1);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return !(1 + 1);
}
}
?>

View File

@ -1,33 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
/**
* @return bool
*/
public function run()
{
return empty(!trim(''));
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
/**
* @return bool
*/
public function run()
{
return !!trim('');
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return empty('foo');
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return !'foo';
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return empty(new stdClass());
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return !new stdClass();
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return isset(some_function(), $a, $b, some_function(), $c, some_function());
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return some_function() !== null && isset($a, $b) && some_function() !== null && isset($c) && some_function() !== null;
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return isset(some_function()) && isset($var);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return some_function() !== null && isset($var);
}
}
?>

View File

@ -1,13 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return empty(some_function()['a']);
}
}
?>

View File

@ -1,14 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
$object = new stdClass();
return isset($object->foo); // must not changed
}
}
?>

View File

@ -1,13 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector\Fixture;
final class SomeClass
{
public function run()
{
return isset(stdClass::$foo); // must not changed
}
}
?>

View File

@ -1,10 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DowngradePhp55\Rector\Isset_\DowngradeArbitraryExpressionArgsToEmptyAndIssetRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(DowngradeArbitraryExpressionArgsToEmptyAndIssetRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class DowngradeArgumentUnpackingRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallInlinedArgs
{
public function run(mixed $item)
{
some_function('foo', ...[$item, 'baz'], 'bar', 'qux');
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallInlinedArgs
{
public function run(mixed $item)
{
call_user_func_array('some_function', ['foo', $item, 'baz', 'bar', 'qux']);
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallMixedArgs
{
public function run(array $items)
{
some_function('foo', 'bar', ...$items, 'baz');
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallMixedArgs
{
public function run(array $items)
{
call_user_func_array('some_function', array_merge(['foo', 'bar'], $items, ['baz']));
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallMultiUnpackArgs
{
public function run(array $items, array $otherItems)
{
some_function(...$items, ...$otherItems);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallMultiUnpackArgs
{
public function run(array $items, array $otherItems)
{
call_user_func_array('some_function', array_merge($items, $otherItems));
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallOnArg
{
public function run(array $items)
{
some_function(...$items);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class FuncCallOnArg
{
public function run(array $items)
{
call_user_func_array('some_function', $items);
}
}
?>

View File

@ -1,47 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class MethodCallChained
{
public function run()
{
var_dump(func_get_args());
}
public function chain()
{
return $this;
}
public function call(array $items)
{
$this->chain(...$items)->run(...$items);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class MethodCallChained
{
public function run()
{
var_dump(func_get_args());
}
public function chain()
{
return $this;
}
public function call(array $items)
{
call_user_func_array([call_user_func_array([$this, 'chain'], $items), 'run'], $items);
}
}
?>

View File

@ -1,39 +0,0 @@
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class MethodCallExpr
{
public function run()
{
var_dump(func_get_args());
}
public function call(array $items)
{
$method = 'run';
$this->$method(...$items);
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp56\Rector\CallLike\DowngradeArgumentUnpackingRector\Fixture;
final class MethodCallExpr
{
public function run()
{
var_dump(func_get_args());
}
public function call(array $items)
{
$method = 'run';
call_user_func_array([$this, $method], $items);
}
}
?>

Some files were not shown because too many files have changed in this diff Show More