From aff9edb630aac40c58bc39df9481efc28c8b11bc Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Sun, 9 Oct 2016 19:06:20 +0200 Subject: [PATCH] Don't crash on array assignments --- src/PhpDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpDocument.php b/src/PhpDocument.php index fdb4609..6ba2900 100644 --- a/src/PhpDocument.php +++ b/src/PhpDocument.php @@ -525,7 +525,7 @@ class PhpDocument } // Check each previous sibling node for a variable assignment to that variable while ($n->getAttribute('previousSibling') && $n = $n->getAttribute('previousSibling')) { - if ($n instanceof Node\Expr\Assign && $n->var->name === $var->name) { + if ($n instanceof Node\Expr\Assign && $n->var instanceof Node\Expr\Variable && $n->var->name === $var->name) { return $n; } }