diff --git a/src/Functions/NoParameterWithNullDefaultValueRule.php b/src/Functions/NoParameterWithNullDefaultValueRule.php index fdf6e76a..fae24d23 100644 --- a/src/Functions/NoParameterWithNullDefaultValueRule.php +++ b/src/Functions/NoParameterWithNullDefaultValueRule.php @@ -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)) { @@ -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(); + } }