From ecfbb324fca2fbf4d227b475f0da4eecea2d6e50 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Thu, 21 May 2026 13:30:23 +0000 Subject: [PATCH] fix(route) when load the middlware we lose the route chain --- src/Router/Router.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Router/Router.php b/src/Router/Router.php index 31ee6b8d..0610cfd5 100644 --- a/src/Router/Router.php +++ b/src/Router/Router.php @@ -17,7 +17,7 @@ class Router * * @var array */ - protected array $routes = []; + protected static array $routes = []; /** * Define the functions related to a http @@ -307,7 +307,7 @@ private function push(string|array $methods, string $path, callable|string|array $route->middleware($this->middlewares); foreach ($methods as $method) { - $this->routes[$method][] = $route; + static::$routes[$method][] = $route; // We define the current route and current method $this->current = ['path' => $path, 'method' => $method]; @@ -490,7 +490,7 @@ public function match(array $methods, string $path, callable|string|array $cb): */ public function getRoutes(): array { - return $this->routes; + return static::$routes; } /**