From 0f0e543a9744cfb741f3ce724ce62501010d7ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 13 Dec 2024 09:43:25 +0100 Subject: [PATCH] Fix: Reset earlier --- src/Methods/NoParameterWithNullDefaultValueRule.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Methods/NoParameterWithNullDefaultValueRule.php b/src/Methods/NoParameterWithNullDefaultValueRule.php index 778637ed..7a09ec62 100644 --- a/src/Methods/NoParameterWithNullDefaultValueRule.php +++ b/src/Methods/NoParameterWithNullDefaultValueRule.php @@ -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 []; @@ -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; @@ -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; @@ -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