Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"license": "MIT",
"description": "Rector downgrade PHP rules",
"require": {
"php": ">=8.3"
"php": ">=8.4"
},
"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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,6 @@ private function isNullable(Type $parentReturnType, Type $returnType): bool
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -135,12 +137,6 @@ private function isUnionIntersection(?Node $node): bool
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);
}
}
Loading