From 3b01e2dabc1b6878a412447c122592f73810c1da Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Thu, 8 Apr 2021 00:40:59 +0800 Subject: [PATCH] modify --- Annotation/Loader.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Annotation/Loader.php b/Annotation/Loader.php index a2b45cde..741d200c 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -143,7 +143,6 @@ class Loader extends BaseObject continue; } try { - $this->appendFileToDirectory($path->getRealPath()); $replace = Snowflake::getDi()->getReflect($this->explodeFileName($path, $namespace)); if (empty($replace) || !$replace->isInstantiable()) { @@ -153,6 +152,7 @@ class Loader extends BaseObject if (!$replace->getAttributes(Target::class)) { continue; } + $this->appendFileToDirectory($path->getRealPath(), $replace->getName()); $_array = ['handler' => $replace->newInstanceWithoutConstructor(), 'target' => [], 'methods' => [], 'property' => []]; foreach ($replace->getAttributes() as $attribute) { @@ -293,8 +293,9 @@ class Loader extends BaseObject /** * @param string $filePath + * @param string $className */ - public function appendFileToDirectory(string $filePath) + public function appendFileToDirectory(string $filePath, string $className) { $DIRECTORY = explode(DIRECTORY_SEPARATOR, $filePath); array_pop($DIRECTORY); @@ -303,7 +304,7 @@ class Loader extends BaseObject foreach ($DIRECTORY as $value) { $path = $this->makeMoneyDirectoryArray($path, $value); - $this->_directoryMap[$path][] = $filePath; + $this->_directoryMap[$path][] = $className; } }