fix(diagnostics): handle null case
parent
9b1fafae58
commit
09477b747e
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue