From 3c15820e781787a6d9556b07a1db068a33f2110b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Jul 2021 19:14:46 +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/Router.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/HttpServer/Route/Router.php b/HttpServer/Route/Router.php index bac671d5..cb162c2d 100644 --- a/HttpServer/Route/Router.php +++ b/HttpServer/Route/Router.php @@ -113,15 +113,12 @@ class Router extends HttpService implements RouterInterface */ public function addRoute($path, $handler, string $method = 'any'): ?Node { - $method = strtolower($method); if (!isset(static::$nodes[$method])) { static::$nodes[$method] = []; } - if ($handler instanceof Closure) { - $handler = Closure::bind($handler, new Controller()); + $handler = Closure::bind($handler, di(Controller::class)); } - return $this->hash($path, $handler, $method); }