diff --git a/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php b/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php index 2082f264..e10b4561 100644 --- a/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php +++ b/rules/DowngradePhp73/Rector/List_/DowngradeListReferenceAssignmentRector.php @@ -234,15 +234,12 @@ private function createAssignRefArrayFromListReferences( // Nested list. Combine with the nodes from the recursive call /** @var List_ $nestedList */ $nestedList = $listItem->value; - $listNestedArrayIndexes = array_merge($nestedArrayIndexes, [$key]); - $newNodes = array_merge( - $newNodes, - $this->createAssignRefArrayFromListReferences( - $nestedList->items, - $exprVariable, - $listNestedArrayIndexes - ) - ); + $listNestedArrayIndexes = [...$nestedArrayIndexes, $key]; + $newNodes = [...$newNodes, ...$this->createAssignRefArrayFromListReferences( + $nestedList->items, + $exprVariable, + $listNestedArrayIndexes + )]; } return $newNodes; diff --git a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php index 1e5ff413..30b6a9f0 100644 --- a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php +++ b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeContravariantArgumentTypeRector.php @@ -173,7 +173,7 @@ private function getDifferentParamTypeFromAncestorClass(Param $param, ClassMetho // parent classes or implemented interfaces /** @var ClassReflection[] $parentClassReflections */ - $parentClassReflections = array_merge($classReflection->getParents(), $classReflection->getInterfaces()); + $parentClassReflections = [...$classReflection->getParents(), ...$classReflection->getInterfaces()]; foreach ($parentClassReflections as $parentClassReflection) { $parentReflectionMethod = $this->resolveParentReflectionMethod($parentClassReflection, $methodName); diff --git a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php index 25065ee1..676d92d0 100644 --- a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php +++ b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php @@ -173,7 +173,7 @@ private function resolveDifferentAncestorReturnType( $methodName = $this->getName($classMethod); /** @var ClassReflection[] $parentClassesAndInterfaces */ - $parentClassesAndInterfaces = array_merge($classReflection->getParents(), $classReflection->getInterfaces()); + $parentClassesAndInterfaces = [...$classReflection->getParents(), ...$classReflection->getInterfaces()]; return $this->resolveMatchingReturnType($parentClassesAndInterfaces, $methodName, $classMethod, $returnType); } diff --git a/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php b/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php index 41683ca0..02880a6c 100644 --- a/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php +++ b/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php @@ -89,10 +89,7 @@ public function refactor(Node $node): ?Node continue; } - $collectInterfaces = array_merge( - $collectInterfaces, - $this->familyRelationsAnalyzer->getClassLikeAncestorNames($extend) - ); + $collectInterfaces = [...$collectInterfaces, ...$this->familyRelationsAnalyzer->getClassLikeAncestorNames($extend)]; } if (! $isCleaned) { diff --git a/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php b/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php index 8ae6c568..b0b530dd 100644 --- a/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php +++ b/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php @@ -193,7 +193,7 @@ private function addPropertyAssignsToConstructorClassMethod( /** @var ClassMethod $constructorClassMethod */ $constructorClassMethod = $class->getMethod(MethodName::CONSTRUCT); - $constructorClassMethod->stmts = array_merge($assigns, (array) $constructorClassMethod->stmts); + $constructorClassMethod->stmts = [...$assigns, ...(array) $constructorClassMethod->stmts]; } /**