From 7abcf82c6cd4c7a357533cb44931cf6601bf5654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 4 Mar 2021 10:23:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Annotation/Loader.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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) {