Skip to content

Commit

Permalink
Fix: Reset earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 13, 2024
1 parent 5063cae commit 55fad99
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Closures/NoParameterWithNullableTypeDeclarationRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public function processNode(
return [];
}

$parametersWithNullableTypeDeclaration = \array_filter($node->params, static function (Node\Param $node): bool {
$parametersWithNullableTypeDeclaration = \array_values(\array_filter($node->params, static function (Node\Param $node): bool {
return self::hasNullableTypeDeclaration($node);
});
}));

if (0 === \count($parametersWithNullableTypeDeclaration)) {
return [];
}

return \array_values(\array_map(static function (Node\Param $node): Rules\RuleError {
return \array_map(static function (Node\Param $node): Rules\RuleError {
/** @var Node\Expr\Variable $variable */
$variable = $node->var;

Expand All @@ -59,7 +59,7 @@ public function processNode(
return Rules\RuleErrorBuilder::message($message)
->identifier(ErrorIdentifier::noParameterWithNullableTypeDeclaration()->toString())
->build();
}, $parametersWithNullableTypeDeclaration));
}, $parametersWithNullableTypeDeclaration);
}

private static function hasNullableTypeDeclaration(Node\Param $node): bool
Expand Down

0 comments on commit 55fad99

Please sign in to comment.