From 9ccfc3f1a536d64f523acd4ef95aa2bdc271005f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sun, 16 Apr 2023 23:19:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ControllerInterpreter.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ControllerInterpreter.php b/src/ControllerInterpreter.php index 34a74ce..58a7de9 100644 --- a/src/ControllerInterpreter.php +++ b/src/ControllerInterpreter.php @@ -24,7 +24,7 @@ class ControllerInterpreter if (is_null($reflection)) { $reflection = \Kiri::getDi()->getReflectionClass($class::class); } - return $this->resolveMethod($method, $reflection); + return $this->resolveMethod($class, $method, $reflection); } @@ -53,17 +53,18 @@ class ControllerInterpreter if (is_null($reflection)) { $reflection = \Kiri::getDi()->getReflectionClass($class::class); } - return $this->resolveMethod($method, $reflection); + return $this->resolveMethod($class, $method, $reflection); } /** + * @param object $class * @param string|ReflectionMethod $reflectionMethod * @param ReflectionClass $reflectionClass * @return Handler * @throws ReflectionException */ - public function resolveMethod(string|\ReflectionMethod $reflectionMethod, ReflectionClass $reflectionClass): Handler + public function resolveMethod(object $class, string|\ReflectionMethod $reflectionMethod, ReflectionClass $reflectionClass): Handler { if (is_string($reflectionMethod)) { $reflectionMethod = $reflectionClass->getMethod($reflectionMethod); @@ -72,7 +73,7 @@ class ControllerInterpreter $container = \Kiri::getDi(); $parameters = $container->getMethodParams($reflectionMethod); - return new Handler([$container->get($reflectionClass->getName()), $reflectionMethod->getName()], $parameters); + return new Handler([$class, $reflectionMethod->getName()], $parameters); } }