This commit is contained in:
2023-03-30 18:35:19 +08:00
parent e1687ed535
commit 73754f3bfb
2 changed files with 12 additions and 1 deletions
+3
View File
@@ -331,6 +331,9 @@ class Container implements ContainerInterface
if (isset($this->_parameters[$className]) && isset($this->_parameters[$className][$method])) {
return $this->_parameters[$className][$method];
}
if (!TargetManager::has($className)) {
TargetManager::set($className, $this->getReflect($className));
}
$reflectMethod = $this->getReflectMethod($className, $method);
if (!($reflectMethod instanceof ReflectionMethod)) {
throw new ReflectionException("Class does not have a function $className::$method");
+9 -1
View File
@@ -9,7 +9,6 @@ class TargetManager
private static array $targets = [];
/**
* @param string $class
* @return Target|null
@@ -20,6 +19,15 @@ class TargetManager
}
/**
* @param string $class
* @return bool
*/
public static function has(string $class): bool
{
return isset(static::$targets[$class]) && static::$targets[$class] !== null;
}
/**
* @param string $class
* @param \ReflectionClass $reflection