From 8fd46ab3edb82fbc966f189eba8a316df0bc2984 Mon Sep 17 00:00:00 2001 From: Felix Siebeneicker Date: Tue, 22 Jun 2021 21:07:40 +0200 Subject: [PATCH] Adding source file node check --- src/Node.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Node.php b/src/Node.php index 2eb6ebdc..d1288876 100644 --- a/src/Node.php +++ b/src/Node.php @@ -584,7 +584,7 @@ public function getImportTablesForCurrentScope() { * @return NamespaceDefinition|null */ public function getNamespaceDefinition() { - $namespaceDefinition = $this instanceof NamespaceDefinition + $namespaceDefinition = ($this instanceof NamespaceDefinition || $this instanceof SourceFileNode) ? $this : $this->getFirstAncestor(NamespaceDefinition::class, SourceFileNode::class);