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 e382238 commit 0f0e543
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Methods/NoParameterWithNullDefaultValueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function processNode(
return [];
}

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

if (0 === \count($parametersWithNullDefaultValue)) {
return [];
Expand All @@ -51,7 +51,7 @@ public function processNode(
$classReflection = $scope->getClassReflection();

if ($classReflection->isAnonymous()) {
return \array_values(\array_map(static function (Node\Param $parameterWithNullDefaultValue) use ($methodName): Rules\RuleError {
return \array_map(static function (Node\Param $parameterWithNullDefaultValue) use ($methodName): Rules\RuleError {
/** @var Node\Expr\Variable $variable */
$variable = $parameterWithNullDefaultValue->var;

Expand All @@ -67,12 +67,12 @@ public function processNode(
return Rules\RuleErrorBuilder::message($message)
->identifier(ErrorIdentifier::noParameterWithNullDefaultValue()->toString())
->build();
}, $parametersWithNullDefaultValue));
}, $parametersWithNullDefaultValue);
}

$className = $classReflection->getName();

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

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

private static function hasNullDefaultValue(Node\Param $parameter): bool
Expand Down

0 comments on commit 0f0e543

Please sign in to comment.