From 6cf6d2cfda34da038e5cb9015a9f77221cb1a2ed Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Tue, 6 Nov 2018 09:18:39 -0500 Subject: [PATCH] Add null check --- src/Psalm/Type/ParseTree.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Psalm/Type/ParseTree.php b/src/Psalm/Type/ParseTree.php index 72259b7ea..f5c6999a7 100644 --- a/src/Psalm/Type/ParseTree.php +++ b/src/Psalm/Type/ParseTree.php @@ -108,6 +108,10 @@ class ParseTree } do { + if ($current_leaf->parent === null) { + break; + } + $current_leaf = $current_leaf->parent; } while (!$current_leaf instanceof ParseTree\EncapsulationTree && !$current_leaf instanceof ParseTree\CallableTree