Skip to content

Commit

Permalink
[Php71] Ensure count() function parameter exists early (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Aug 23, 2021
1 parent 68d410e commit 241f8a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rules/Php71/Rector/FuncCall/CountOnNullRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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_;
Expand Down

0 comments on commit 241f8a9

Please sign in to comment.