This commit is contained in:
2023-10-17 15:59:43 +08:00
parent 521377bf8d
commit cb1a45a862
+4 -6
View File
@@ -73,16 +73,14 @@ class ControllerInterpreter
*/
public function resolveMethod(object $class, string|\ReflectionMethod $reflectionMethod, ReflectionClass $reflectionClass): Handler
{
if (is_string($reflectionMethod)) {
$reflectionMethod = $reflectionClass->getMethod($reflectionMethod);
}
$returnType = $reflectionMethod->getReturnType();
if ($returnType instanceof \ReflectionUnionType) {
throw new Exception("Return type error, cannot be multi type.");
}
if (empty($reflectionMethod)) {
return new Handler([$class, $reflectionMethod], [], $returnType);
}
if (is_string($reflectionMethod)) {
$reflectionMethod = $reflectionClass->getMethod($reflectionMethod);
}
$container = \Kiri::getDi();
$parameters = $container->getMethodParams($reflectionMethod);