Skip to content

Commit 911a87e

Browse files
committed
fix issue with various nodes ->toString() calls
1 parent bfea948 commit 911a87e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Searcher.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,23 @@ protected function findReferences(array $ast, string $class, ?string $nodeNamePr
195195
}
196196

197197
if ($node instanceof Node\Expr\MethodCall) {
198+
if (! method_exists($node->name, 'toString')) {
199+
return false;
200+
}
201+
198202
$name = $node->name->toString();
199203

200204
return Arr::matches($name, $names, true);
201205
}
202206

203207
if ($node instanceof Node\Expr\StaticCall) {
208+
if (! method_exists($node->class, 'toString')) {
209+
return false;
210+
}
211+
if (! method_exists($node->name, 'toString')) {
212+
return false;
213+
}
214+
204215
$name = $node->class->toString();
205216
$methodName = $node->name->toString();
206217

0 commit comments

Comments
 (0)