Skip to content

Commit

Permalink
Fix fatal when trying to call toCodeString() in Node\Expr\Variable cl…
Browse files Browse the repository at this point in the history
…ass (#40855)
  • Loading branch information
puntope authored Jan 6, 2025
1 parent ebd9c30 commit 64d3036
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fixes a bug in Analyzer tring to call toCodeString() in Variable class.
5 changes: 5 additions & 0 deletions projects/packages/analyzer/src/class-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ public static function has_function_call( $node, $name ) {
if ( ! $stmt instanceof Node\Stmt\Expression || ! $stmt->expr instanceof Node\Expr\FuncCall ) {
continue;
}

if ( $stmt->expr->name instanceof Node\Expr\Variable ) {
continue;
}

if ( false !== strpos( $stmt->expr->name->toCodeString(), $name ) ) {
return true;
}
Expand Down

0 comments on commit 64d3036

Please sign in to comment.