This commit is contained in:
2021-03-23 10:36:44 +08:00
parent 27be3f4ca9
commit c394f4990b
+4 -2
View File
@@ -124,11 +124,13 @@ class Container extends BaseObject
private function resolve($class, $constrict, $config): object private function resolve($class, $constrict, $config): object
{ {
[$reflect, $dependencies] = $this->resolveDependencies($class, $constrict); [$reflect, $dependencies] = $this->resolveDependencies($class, $constrict);
if (empty($reflect)) {
throw new NotFindClassException($class);
}
foreach ($constrict as $index => $param) { foreach ($constrict as $index => $param) {
$dependencies[$index] = $param; $dependencies[$index] = $param;
} }
var_dump($reflect);
if (!$reflect->isInstantiable()) { if (!$reflect->isInstantiable()) {
throw new NotFindClassException($reflect->getName()); throw new NotFindClassException($reflect->getName());
} }
@@ -173,7 +175,7 @@ class Container extends BaseObject
{ {
if (!isset($this->_reflection[$class])) { if (!isset($this->_reflection[$class])) {
if (!class_exists($class)) { if (!class_exists($class)) {
return null; return null;
} }
$reflection = new ReflectionClass($class); $reflection = new ReflectionClass($class);
if (!$reflection->isInstantiable()) { if (!$reflection->isInstantiable()) {