From 9dd819323cfd6277ea42a07d1b2957a4e8e5a737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 19 Apr 2021 12:37:56 +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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Annotation/Loader.php b/Annotation/Loader.php index 6b7caf4b..a34c5de0 100644 --- a/Annotation/Loader.php +++ b/Annotation/Loader.php @@ -56,8 +56,6 @@ class Loader extends BaseObject public function loader($path, $namespace) { $this->_scanDir(new DirectoryIterator($path), $namespace); - - var_dump($this->_directory); } @@ -149,9 +147,12 @@ class Loader extends BaseObject } if ($path->isDir()) { $iterator = new DirectoryIterator($path->getRealPath()); - $this->_scanDir($iterator, $namespace); + $directory = rtrim($path->getRealPath(), '/'); + if (!isset($this->_directory[$directory])) { + $this->_directory[$directory] = []; + } - $this->_directory[rtrim($path->getRealPath(), '/')] = []; + $this->_scanDir($iterator, $namespace); } else { $array = explode('/', $path->getRealPath()); array_pop($array);