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 55fad99 commit e1a0895
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Closures/NoParameterWithNullDefaultValueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ public function processNode(
return [];
}

$parametersWithNullDefaultValue = \array_filter($node->params, static function (Node\Param $node): bool {
$parametersWithNullDefaultValue = \array_values(\array_filter($node->params, static function (Node\Param $node): bool {
if (!$node->default instanceof Node\Expr\ConstFetch) {
return false;
}

return 'null' === $node->default->name->toLowerString();
});
}));

if (0 === \count($parametersWithNullDefaultValue)) {
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 @@ -63,6 +63,6 @@ public function processNode(
return Rules\RuleErrorBuilder::message($message)
->identifier(ErrorIdentifier::noParameterWithNullDefaultValue()->toString())
->build();
}, $parametersWithNullDefaultValue));
}, $parametersWithNullDefaultValue);
}
}

0 comments on commit e1a0895

Please sign in to comment.