From 09477b747efc254aedfd4485a79f084a7fc4904a Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Sun, 3 Dec 2017 15:49:43 -0800 Subject: [PATCH] fix(diagnostics): handle null case --- src/TreeAnalyzer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TreeAnalyzer.php b/src/TreeAnalyzer.php index c6bd6d7..465f5bb 100644 --- a/src/TreeAnalyzer.php +++ b/src/TreeAnalyzer.php @@ -99,7 +99,7 @@ class TreeAnalyzer // Find the first ancestor that's a class method. Return an error // if there is none, or if the method is static. $method = $node->getFirstAncestor(Node\MethodDeclaration::class); - if ($method->isStatic()) { + if ($method && $method->isStatic()) { $this->diagnostics[] = new Diagnostic( "\$this can not be used in static methods.", Range::fromNode($node),