Skip to content

Commit b4bad6b

Browse files
authored
Fix variable named function calls (#12)
1 parent 53c2cbb commit b4bad6b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/NodeVisitor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public function enterNode(Node $node)
166166
} elseif (
167167
$node instanceof Expression &&
168168
$node->expr instanceof FuncCall &&
169+
$node->expr->name instanceof Name &&
169170
$node->expr->name->parts[0] === 'define'
170171
) {
171172
$this->isInDeclaration = true;
@@ -200,6 +201,7 @@ public function leaveNode(Node $node, bool $preserveStack = false)
200201
|| (
201202
$node instanceof Expression &&
202203
$node->expr instanceof FuncCall &&
204+
$node->expr->name instanceof Name &&
203205
$node->expr->name->parts[0] === 'define'
204206
)
205207
) {
@@ -373,6 +375,7 @@ function (\PhpParser\Node\Const_ $const) {
373375
if (
374376
$node instanceof Expression &&
375377
$node->expr instanceof FuncCall &&
378+
$node->expr->name instanceof Name &&
376379
$node->expr->name->parts[0] === 'define'
377380
) {
378381
$fullyQualifiedName = $node->expr->args[0]->value->value;

0 commit comments

Comments
 (0)