diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index 8d42fd84..663bcab4 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -82,20 +82,20 @@ class Node extends HttpService $this->handler = $handler; } if (!empty($this->handler)) { - $this->callback = Reduce::reduce([$this, 'createDispatch'], $this->annotation($this)); + $this->callback = Reduce::reduce($this->createDispatch(), $this->annotation($this)); } return $this; } /** - * @return mixed - * @throws NotFindClassException - * @throws ReflectionException + * @return Closure */ - public function createDispatch(): mixed + public function createDispatch(): Closure { - return Dispatch::create($this->handler, func_get_args())->dispatch(); + return function () { + return Dispatch::create($this->handler, func_get_args())->dispatch(); + }; } @@ -550,8 +550,6 @@ class Node extends HttpService } - - /** * @return mixed * @throws Exception