This commit is contained in:
2021-02-22 18:23:33 +08:00
parent a40e57db50
commit 6d79796bac
2 changed files with 13 additions and 4 deletions
+3 -4
View File
@@ -122,10 +122,9 @@ class Annotation extends Component
if (empty($reflect)) { if (empty($reflect)) {
return []; return [];
} }
if (!$reflect->isInstantiable()) { $depend = Snowflake::getDi()->getDependencies($class);
return $this->targets($reflect);
} $object = $reflect->newInstanceArgs($depend);
$object = $reflect->newInstance();
$this->resolveMethod($reflect, $class, $alias, $object); $this->resolveMethod($reflect, $class, $alias, $object);
return $this->targets($reflect); return $this->targets($reflect);
} }
+10
View File
@@ -192,6 +192,16 @@ class Container extends BaseObject
} }
/**
* @param $class
* @return mixed
*/
public function getDependencies($class): mixed
{
return $this->_constructs[$class] ?? [];
}
/** /**
* @param $class * @param $class
* @return ReflectionClass|null * @return ReflectionClass|null