Skip to content

Commit

Permalink
Enhancement: Extract method
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 13, 2024
1 parent e4fc3cc commit 19357c0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Functions/NoParameterWithNullDefaultValueRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ public function processNode(
}

$params = \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();
return self::hasNullDefaultValue($node);
});

if (0 === \count($params)) {
Expand All @@ -68,4 +64,13 @@ public function processNode(
->build();
}, $params));
}

private static function hasNullDefaultValue(Node\Param $node): bool
{
if (!$node->default instanceof Node\Expr\ConstFetch) {
return false;
}

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

0 comments on commit 19357c0

Please sign in to comment.