From b65631c85a6475a2c573a49f77d0db52e9648583 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 3 Jul 2026 04:01:41 +0700 Subject: [PATCH 1/5] Update boundwize/structarmed version to ^0.14 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6b5a62db..765b6bdb 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "php": ">=8.3" }, "require-dev": { - "boundwize/structarmed": "^0.9", + "boundwize/structarmed": "^0.14", "phpstan/extension-installer": "^1.4", "phpstan/phpstan": "^2.1.33", "phpstan/phpstan-webmozart-assert": "^2.0", From bfa2eb929d63760faf57fc4861f22afbda5f5ec6 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 3 Jul 2026 04:03:31 +0700 Subject: [PATCH 2/5] Upgrade PHP requirement from 8.3 to 8.4 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 765b6bdb..32bdc647 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "MIT", "description": "Rector downgrade PHP rules", "require": { - "php": ">=8.3" + "php": ">=8.4" }, "require-dev": { "boundwize/structarmed": "^0.14", From e5ba87adfb7860837503d0936abc7873ad43ffcf Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 3 Jul 2026 04:04:13 +0700 Subject: [PATCH 3/5] Update PHP version from 8.3 to 8.4 in workflow --- .github/workflows/rector.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rector.yaml b/.github/workflows/rector.yaml index 8c447308..b87d60ca 100644 --- a/.github/workflows/rector.yaml +++ b/.github/workflows/rector.yaml @@ -23,7 +23,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none - uses: "ramsey/composer-install@v2" From 8858a013b2695c0fb1d65ed361055021bd9be2c4 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 2 Jul 2026 21:04:49 +0000 Subject: [PATCH 4/5] [rector] Rector fixes --- .../DowngradeParameterTypeWideningRector.php | 8 +------- .../DowngradeCovariantReturnTypeRector.php | 9 +-------- .../Class_/DowngradeUnionIntersectionRector.php | 11 +++-------- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php b/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php index b153bc67..37a8987a 100644 --- a/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php +++ b/rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php @@ -211,13 +211,7 @@ private function removeParamTypeFromMethod(ClassMethod $classMethod, int $paramP private function hasParamAlreadyNonTyped(ClassMethod $classMethod): bool { - foreach ($classMethod->params as $param) { - if ($param->type !== null) { - return false; - } - } - - return true; + return array_all($classMethod->params, fn(Param $param): bool => !$param->type instanceof Node); } private function isSafeType(ClassReflection $classReflection, ClassMethod $classMethod): bool diff --git a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php index c1184515..ea01106f 100644 --- a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php +++ b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php @@ -260,13 +260,6 @@ private function isNullable(Type $parentReturnType, Type $returnType): bool if (! TypeCombinator::containsNull($parentReturnType)) { return false; } - - foreach ($parentReturnType->getTypes() as $type) { - if ($type->equals($returnType)) { - return true; - } - } - - return false; + return array_any($parentReturnType->getTypes(), fn(Type $type): bool => $type->equals($returnType)); } } diff --git a/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php b/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php index 9f7ee694..48f0d2a4 100644 --- a/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php +++ b/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php @@ -4,6 +4,8 @@ namespace Rector\DowngradePhp82\Rector\Class_; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; use PhpParser\Node; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Closure; @@ -134,13 +136,6 @@ private function isUnionIntersection(?Node $node): bool if (! $node instanceof UnionType) { return false; } - - foreach ($node->types as $type) { - if ($type instanceof IntersectionType) { - return true; - } - } - - return false; + return array_any($node->types, fn(Identifier|Name|IntersectionType $type): bool => $type instanceof IntersectionType); } } From 563c78e71e31b9c00817ecc9f426c304c652f292 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 2 Jul 2026 21:05:18 +0000 Subject: [PATCH 5/5] [rector] Rector fixes --- .../Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php | 1 + .../Rector/Class_/DowngradeUnionIntersectionRector.php | 1 + 2 files changed, 2 insertions(+) diff --git a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php index ea01106f..c3505300 100644 --- a/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php +++ b/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php @@ -260,6 +260,7 @@ private function isNullable(Type $parentReturnType, Type $returnType): bool if (! TypeCombinator::containsNull($parentReturnType)) { return false; } + return array_any($parentReturnType->getTypes(), fn(Type $type): bool => $type->equals($returnType)); } } diff --git a/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php b/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php index 48f0d2a4..1acdb235 100644 --- a/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php +++ b/rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php @@ -136,6 +136,7 @@ private function isUnionIntersection(?Node $node): bool if (! $node instanceof UnionType) { return false; } + return array_any($node->types, fn(Identifier|Name|IntersectionType $type): bool => $type instanceof IntersectionType); } }