This commit is contained in:
2021-02-22 18:11:23 +08:00
parent cfc2d98076
commit b06c8e3da1
3 changed files with 12 additions and 27 deletions
+5 -2
View File
@@ -119,6 +119,9 @@ class Annotation extends Component
private function getReflect(string $class, string $alias): array
{
$reflect = $this->reflectClass($class);
if (empty($reflect)) {
return [];
}
if (!$reflect->isInstantiable()) {
return $this->targets($reflect);
}
@@ -190,10 +193,10 @@ class Annotation extends Component
/**
* @param string $class
* @return ReflectionClass
* @return ReflectionClass|null
* @throws ReflectionException
*/
private function reflectClass(string $class): ReflectionClass
private function reflectClass(string $class): ?ReflectionClass
{
return Snowflake::getDi()->getReflect($class);
}