From 6bb24e5b42f8307549e48802258ce61feb4f4e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Jul 2021 17:13:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Route/Node.php | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 726535c4..0d4c5ccf 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -149,10 +149,10 @@ class Node extends HttpService { $reflect = $aop->getAop($this->handler); $callback = [$reflect->getMethod('invoke'), 'invokeArgs']; - return static function () use ($callback, $application, $reflect) { - $dispatchParam = Context::getContext('dispatch-param', [\request()]); - call_user_func($callback, $reflect->newInstance($application->handler), $dispatchParam); + $instance = $reflect->newInstance($application->handler); + return static function () use ($callback, $application, $instance, $reflect) { + call_user_func($callback, $instance, ...func_get_args()); }; } @@ -164,8 +164,7 @@ class Node extends HttpService private function normalHandler($application): Closure { return static function () use ($application) { - $dispatchParam = Context::getContext('dispatch-param', [\request()]); - return call_user_func($application->handler, ...$dispatchParam); + return call_user_func($application->handler, ...func_get_args()); }; } @@ -208,24 +207,6 @@ class Node extends HttpService } - /** - * @param Closure|array|string $handler - * @throws Exception - */ - public function addLimits(Closure|string|array $handler) - { - if (!is_array($handler) || is_object($handler[0])) { - $handler = [$handler]; - } - foreach ($handler as $closure) { - if (in_array($closure, $this->_limits)) { - continue; - } - $this->_limits[] = $closure; - } - } - - /** * @return string * 错误信息