From 968814bd577aa19d73ad9cdadcdfcc8972bc1c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 7 Sep 2021 15:45:48 +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 --- http-helper/Route/Router.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/http-helper/Route/Router.php b/http-helper/Route/Router.php index f8245599..5a41e957 100644 --- a/http-helper/Route/Router.php +++ b/http-helper/Route/Router.php @@ -366,17 +366,15 @@ class Router extends HttpService implements RouterInterface * @param array $config * @param callable $callback * 路由分组 - * @param null $stdClass */ - public function group(array $config, callable $callback, $stdClass = null) + public static function group(array $config, callable $callback) { - $this->groupTacks[] = $config; - if ($stdClass) { - $callback($stdClass); - } else { - $callback($this); - } - array_pop($this->groupTacks); + $router = Kiri::getDi()->get(Router::class); + $router->groupTacks[] = $config; + + call_user_func($callback); + + array_pop($router->groupTacks); } /**