From 09a1603eceb86e6f202304a962851f7254a64762 Mon Sep 17 00:00:00 2001 From: Erik van der Bas Date: Mon, 7 Oct 2024 09:39:22 +0200 Subject: [PATCH] fix: Fix for function generator not working because class is not defined (#16) --- lib/Compiler/Method/Method.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Compiler/Method/Method.php b/lib/Compiler/Method/Method.php index 68fd3b1..a1f5d19 100644 --- a/lib/Compiler/Method/Method.php +++ b/lib/Compiler/Method/Method.php @@ -89,13 +89,14 @@ public function compile() // Return Tag $contents .= (new Return_($this->method))->compile(); - if (!empty($this->class->getParentMethods()) + if ( + $this->class && !empty($this->class->getParentMethods()) && in_array($this->method->reflection->getFqsen()->__toString(), array_keys($this->class->getParentMethods())) - ) { + ) { $contents .= self::NEWLINE; $contents .= '*This method is inherited from `' . $this->class->getParent() . '`.*'; $contents .= self::PARAGRAPH; - } + } if ($this->method->hasParameters()) { $paramsTable = new Table($this->method->getParameters());