-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ class RouteList implements Router | |
{ | ||
protected ?self $parent; | ||
|
||
/** @var array of [Router, flags] */ | ||
/** @var array<{Router, bool}> */ | ||
private array $list = []; | ||
Check failure on line 23 in src/Routing/RouteList.php GitHub Actions / PHPStan
|
||
|
||
/** @var Router[][]|null */ | ||
|
@@ -136,8 +136,8 @@ public function warmupCache(): void | |
// find best key | ||
$candidates = []; | ||
$routers = []; | ||
foreach ($this->list as [$router, $flags]) { | ||
if ($flags & self::ONE_WAY) { | ||
foreach ($this->list as [$router, $oneWay]) { | ||
if ($oneWay) { | ||
continue; | ||
} elseif ($router instanceof self) { | ||
$router->warmupCache(); | ||
|
@@ -187,9 +187,9 @@ public function warmupCache(): void | |
/** | ||
* Adds a router. | ||
*/ | ||
public function add(Router $router, int $flags = 0): static | ||
public function add(Router $router, int $oneWay = 0): static | ||
{ | ||
$this->list[] = [$router, $flags]; | ||
$this->list[] = [$router, $oneWay]; | ||
$this->ranks = null; | ||
return $this; | ||
} | ||
|
@@ -198,9 +198,9 @@ public function add(Router $router, int $flags = 0): static | |
/** | ||
* Prepends a router. | ||
*/ | ||
public function prepend(Router $router, int $flags = 0): void | ||
public function prepend(Router $router, int $oneWay = 0): void | ||
{ | ||
array_splice($this->list, 0, 0, [[$router, $flags]]); | ||
array_splice($this->list, 0, 0, [[$router, $oneWay]]); | ||
$this->ranks = null; | ||
} | ||
|
||
|
@@ -225,9 +225,9 @@ protected function modify(int $index, ?Router $router): void | |
* @param array $metadata default values or metadata | ||
* @return static | ||
*/ | ||
public function addRoute(string $mask, array $metadata = [], int $flags = 0) | ||
public function addRoute(string $mask, array $metadata = [], int $oneWay = 0) | ||
{ | ||
$this->add(new Route($mask, $metadata), $flags); | ||
$this->add(new Route($mask, $metadata), $oneWay); | ||
return $this; | ||
} | ||
|
||
|