This commit is contained in:
2021-09-06 15:49:23 +08:00
parent 95185d3a93
commit 2e7c63e012
2 changed files with 7 additions and 6 deletions
+7 -3
View File
@@ -6,10 +6,10 @@ namespace Annotation;
use DirectoryIterator;
use Exception;
use ReflectionClass;
use ReflectionException;
use Kiri\Abstracts\BaseObject;
use Kiri\Kiri;
use ReflectionClass;
use ReflectionException;
use Throwable;
@@ -151,7 +151,11 @@ class Loader extends BaseObject
*/
private function getReflect(DirectoryIterator $path, string $namespace): ?ReflectionClass
{
return Kiri::getDi()->getReflect($this->explodeFileName($path, $namespace));
$class = $this->explodeFileName($path, $namespace);
if (!class_exists($class)) {
return null;
}
return Kiri::getDi()->getReflect($class);
}