Skip to content

Commit 3194bde

Browse files
committed
[ci-review] Rector Rectify
1 parent 7ac71e9 commit 3194bde

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎utils/phpstan/src/Rule/NarrowReturnToUnionParamRule.php‎

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

55
namespace Rector\Utils\PHPStan\Rule;
66

7+
use PhpParser\Node\IntersectionType;
78
use PhpParser\Node;
89
use PhpParser\Node\ComplexType;
910
use PhpParser\Node\Expr\Variable;
@@ -111,14 +112,7 @@ private function isNullableReturnType(null|Identifier|Name|ComplexType $type): b
111112
if (! $type instanceof UnionType) {
112113
return false;
113114
}
114-
115-
foreach ($type->types as $memberType) {
116-
if ($memberType instanceof Identifier && $memberType->toLowerString() === 'null') {
117-
return true;
118-
}
119-
}
120-
121-
return false;
115+
return array_any($type->types, fn(Identifier|Name|IntersectionType $memberType): bool => $memberType instanceof Identifier && $memberType->toLowerString() === 'null');
122116
}
123117

124118
/**

0 commit comments

Comments
 (0)