We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a95e51a commit 25693a0Copy full SHA for 25693a0
src/PhpNodeVisitor.php
@@ -6,6 +6,7 @@
6
use PhpParser\Comment;
7
use PhpParser\Node;
8
use PhpParser\Node\Expr\FuncCall;
9
+use PhpParser\Node\Name;
10
use PhpParser\NodeVisitor;
11
12
class PhpNodeVisitor implements NodeVisitor
@@ -28,9 +29,9 @@ public function beforeTraverse(array $nodes)
28
29
public function enterNode(Node $node)
30
{
31
if ($node instanceof FuncCall) {
- $name = $node->name->getLast();
32
+ $name = ($node->name instanceof Name) ? $node->name->getLast() : null;
33
- if ($this->validFunctions === null || in_array($name, $this->validFunctions)) {
34
+ if ($name && ($this->validFunctions === null || in_array($name, $this->validFunctions))) {
35
$this->functions[] = $this->createFunction($node);
36
}
37
0 commit comments