diff --git a/Annotation/Loader.php b/Annotation/Loader.php index 41166e4f..21416805 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -206,11 +206,15 @@ class Loader extends BaseObject */ public function loadByDirectory(string $path) { - foreach ($this->_fileMap as $value) { - if (!str_starts_with($value, $path)) { + foreach ($this->_fileMap as $fileName => $className) { + if (!str_starts_with($fileName, $path)) { continue; } - $annotations = $this->getClassByFilepath($path); + if (!isset($this->_classes[$className])) { + continue; + } + + $annotations = $this->_classes[$className]; foreach ($annotations['methods'] as $name => $attribute) { foreach ($attribute as $value) {