diff --git a/System/Di/Container.php b/System/Di/Container.php index b6534c13..6f09dbea 100644 --- a/System/Di/Container.php +++ b/System/Di/Container.php @@ -215,6 +215,9 @@ class Container extends BaseObject */ private function resolveDependencies($class): ?array { + if (!isset($this->_constructs[$class])) { + $this->_constructs[$class] = ['class' => $class]; + } if (isset($this->_reflection[$class])) { return [$this->_reflection[$class], $this->_constructs[$class] ?? []]; } @@ -223,15 +226,14 @@ class Container extends BaseObject if (!$reflection->isInstantiable()) { return null; } - $this->scanProperty($reflection); $this->_reflection[$class] = $reflection; - if (!is_null($construct = $reflection->getConstructor())) { - $this->_constructs[$class] = $this->resolveMethodParam($construct); + $this->_constructs[$class] = array_merge($this->_constructs[$class], + $this->resolveMethodParam($construct) + ); } - return [$reflection, $this->_constructs[$class] ?? []]; }