diff --git a/rules/Php71/Rector/FuncCall/CountOnNullRector.php b/rules/Php71/Rector/FuncCall/CountOnNullRector.php index 8423097c025..446c145b226 100644 --- a/rules/Php71/Rector/FuncCall/CountOnNullRector.php +++ b/rules/Php71/Rector/FuncCall/CountOnNullRector.php @@ -133,6 +133,10 @@ private function shouldSkip(FuncCall $funcCall): bool return true; } + if (! isset($funcCall->args[0])) { + return true; + } + if ($funcCall->args[0]->value instanceof ClassConstFetch) { return true; } @@ -149,10 +153,6 @@ private function shouldSkip(FuncCall $funcCall): bool return true; } - if (! isset($funcCall->args[0])) { - return true; - } - // skip node in trait, as impossible to analyse $classLike = $funcCall->getAttribute(AttributeKey::CLASS_NODE); return $classLike instanceof Trait_;