Skip to content

Commit ecfbb32

Browse files
committed
fix(route) when load the middlware we lose the route chain
1 parent b725520 commit ecfbb32

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Router/Router.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Router
1717
*
1818
* @var array
1919
*/
20-
protected array $routes = [];
20+
protected static array $routes = [];
2121

2222
/**
2323
* Define the functions related to a http
@@ -307,7 +307,7 @@ private function push(string|array $methods, string $path, callable|string|array
307307
$route->middleware($this->middlewares);
308308

309309
foreach ($methods as $method) {
310-
$this->routes[$method][] = $route;
310+
static::$routes[$method][] = $route;
311311

312312
// We define the current route and current method
313313
$this->current = ['path' => $path, 'method' => $method];
@@ -490,7 +490,7 @@ public function match(array $methods, string $path, callable|string|array $cb):
490490
*/
491491
public function getRoutes(): array
492492
{
493-
return $this->routes;
493+
return static::$routes;
494494
}
495495

496496
/**

0 commit comments

Comments
 (0)