Skip to content

Commit bed018a

Browse files
committed
refactor: improve parameter name
1 parent a70eafb commit bed018a

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

system/Router/RouteCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,9 @@ public function shouldAutoRoute(): bool
485485
/**
486486
* Returns the raw array of available routes.
487487
*
488-
* @param bool $only Whether to return without '*' routes.
488+
* @param bool $includeWildcard Whether to include '*' routes.
489489
*/
490-
public function getRoutes(?string $verb = null, bool $only = false): array
490+
public function getRoutes(?string $verb = null, bool $includeWildcard = true): array
491491
{
492492
if (empty($verb)) {
493493
$verb = $this->getHTTPVerb();
@@ -503,7 +503,7 @@ public function getRoutes(?string $verb = null, bool $only = false): array
503503
if (isset($this->routes[$verb])) {
504504
// Keep current verb's routes at the beginning, so they're matched
505505
// before any of the generic, "add" routes.
506-
$collection = ! $only ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb];
506+
$collection = $includeWildcard ? $this->routes[$verb] + ($this->routes['*'] ?? []) : $this->routes[$verb];
507507

508508
foreach ($collection as $r) {
509509
$key = key($r['route']);

system/Router/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request
145145
);
146146
} else {
147147
$this->autoRouter = new AutoRouter(
148-
$this->collection->getRoutes('cli', true), // @phpstan-ignore-line
148+
$this->collection->getRoutes('cli', false), // @phpstan-ignore-line
149149
$this->collection->getDefaultNamespace(),
150150
$this->collection->getDefaultController(),
151151
$this->collection->getDefaultMethod(),

user_guide_src/source/changelogs/v4.3.7.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Release Date: Unreleased
1212
BREAKING
1313
********
1414

15-
- **RouteCollection:** The second parameter ``bool $only = false`` has been added
16-
to the ``RouteCollection::getRoutes()`` method.
15+
- **RouteCollection:** The second parameter ``bool $includeWildcard = true`` has
16+
been added to the ``RouteCollection::getRoutes()`` method.
1717
- **AutoRouting Legacy:** The first parameter of the ``AutoRouter::__construct()``
1818
has been changed from ``$protectedControllers`` to ``$cliRoutes``.
1919
- **FeatureTestTrait:** When using :ref:`withBodyFormat() <feature-formatting-the-request>`,

0 commit comments

Comments
 (0)