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; } /**