Skip to content

Commit 9e40368

Browse files
authored
Update boundwize/structarmed version to ^0.14 (#381)
1 parent ab31be8 commit 9e40368

5 files changed

Lines changed: 8 additions & 24 deletions

File tree

.github/workflows/rector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
-
2424
uses: shivammathur/setup-php@v2
2525
with:
26-
php-version: 8.3
26+
php-version: 8.4
2727
coverage: none
2828

2929
- uses: "ramsey/composer-install@v2"

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"license": "MIT",
55
"description": "Rector downgrade PHP rules",
66
"require": {
7-
"php": ">=8.3"
7+
"php": ">=8.4"
88
},
99
"require-dev": {
10-
"boundwize/structarmed": "^0.9",
10+
"boundwize/structarmed": "^0.14",
1111
"phpstan/extension-installer": "^1.4",
1212
"phpstan/phpstan": "^2.1.33",
1313
"phpstan/phpstan-webmozart-assert": "^2.0",

rules/DowngradePhp72/Rector/ClassMethod/DowngradeParameterTypeWideningRector.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,7 @@ private function removeParamTypeFromMethod(ClassMethod $classMethod, int $paramP
211211

212212
private function hasParamAlreadyNonTyped(ClassMethod $classMethod): bool
213213
{
214-
foreach ($classMethod->params as $param) {
215-
if ($param->type !== null) {
216-
return false;
217-
}
218-
}
219-
220-
return true;
214+
return array_all($classMethod->params, fn(Param $param): bool => !$param->type instanceof Node);
221215
}
222216

223217
private function isSafeType(ClassReflection $classReflection, ClassMethod $classMethod): bool

rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,6 @@ private function isNullable(Type $parentReturnType, Type $returnType): bool
261261
return false;
262262
}
263263

264-
foreach ($parentReturnType->getTypes() as $type) {
265-
if ($type->equals($returnType)) {
266-
return true;
267-
}
268-
}
269-
270-
return false;
264+
return array_any($parentReturnType->getTypes(), fn(Type $type): bool => $type->equals($returnType));
271265
}
272266
}

rules/DowngradePhp82/Rector/Class_/DowngradeUnionIntersectionRector.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Rector\DowngradePhp82\Rector\Class_;
66

7+
use PhpParser\Node\Identifier;
8+
use PhpParser\Node\Name;
79
use PhpParser\Node;
810
use PhpParser\Node\Expr\ArrowFunction;
911
use PhpParser\Node\Expr\Closure;
@@ -135,12 +137,6 @@ private function isUnionIntersection(?Node $node): bool
135137
return false;
136138
}
137139

138-
foreach ($node->types as $type) {
139-
if ($type instanceof IntersectionType) {
140-
return true;
141-
}
142-
}
143-
144-
return false;
140+
return array_any($node->types, fn(Identifier|Name|IntersectionType $type): bool => $type instanceof IntersectionType);
145141
}
146142
}

0 commit comments

Comments
 (0)