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

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

if (0 === \count($parametersWithNullableTypeDeclaration)) {
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 $node) use ($methodName): Rules\RuleError {
return \array_map(static function (Node\Param $node) use ($methodName): Rules\RuleError {
/** @var Node\Expr\Variable $variable */
$variable = $node->var;

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

$className = $classReflection->getName();

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

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

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

0 comments on commit 4b2f92d

Please sign in to comment.