Skip to content

Commit c1678b7

Browse files
committed
refactor: remove unused $httpVerb
1 parent ca2f5d8 commit c1678b7

File tree

4 files changed

+9
-22
lines changed

4 files changed

+9
-22
lines changed

system/Router/AutoRouter.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ final class AutoRouter implements AutoRouterInterface
5050
*/
5151
private bool $translateURIDashes;
5252

53-
/**
54-
* HTTP verb for the request.
55-
*/
56-
private string $httpVerb;
57-
5853
/**
5954
* Default namespace for controllers.
6055
*/
@@ -65,13 +60,11 @@ public function __construct(
6560
string $defaultNamespace,
6661
string $defaultController,
6762
string $defaultMethod,
68-
bool $translateURIDashes,
69-
string $httpVerb
63+
bool $translateURIDashes
7064
) {
7165
$this->cliRoutes = $cliRoutes;
7266
$this->defaultNamespace = $defaultNamespace;
7367
$this->translateURIDashes = $translateURIDashes;
74-
$this->httpVerb = $httpVerb;
7568

7669
$this->controller = $defaultController;
7770
$this->method = $defaultMethod;

system/Router/AutoRouterImproved.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,13 @@ final class AutoRouterImproved implements AutoRouterInterface
104104
/**
105105
* @param class-string[] $protectedControllers
106106
* @param string $defaultController Short classname
107-
*
108-
* @deprecated $httpVerb is deprecated. No longer used.
109107
*/
110-
public function __construct(// @phpstan-ignore-line
108+
public function __construct(
111109
array $protectedControllers,
112110
string $namespace,
113111
string $defaultController,
114112
string $defaultMethod,
115-
bool $translateURIDashes,
116-
string $httpVerb
113+
bool $translateURIDashes
117114
) {
118115
$this->protectedControllers = $protectedControllers;
119116
$this->namespace = rtrim($namespace, '\\');

system/Router/Router.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,15 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request
151151
$this->collection->getDefaultNamespace(),
152152
$this->collection->getDefaultController(),
153153
$this->collection->getDefaultMethod(),
154-
$this->translateURIDashes,
155-
$this->collection->getHTTPVerb()
154+
$this->translateURIDashes
156155
);
157156
} else {
158157
$this->autoRouter = new AutoRouter(
159158
$this->collection->getRoutes('CLI', false), // @phpstan-ignore-line
160159
$this->collection->getDefaultNamespace(),
161160
$this->collection->getDefaultController(),
162161
$this->collection->getDefaultMethod(),
163-
$this->translateURIDashes,
164-
$this->collection->getHTTPVerb()
162+
$this->translateURIDashes
165163
);
166164
}
167165
}

tests/system/Router/AutoRouterImprovedTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ protected function setUp(): void
4242
$this->collection = new RouteCollection(Services::locator(), $moduleConfig, new Routing());
4343
}
4444

45-
private function createNewAutoRouter(string $httpVerb = 'GET', $namespace = 'CodeIgniter\Router\Controllers'): AutoRouterImproved
45+
private function createNewAutoRouter($namespace = 'CodeIgniter\Router\Controllers'): AutoRouterImproved
4646
{
4747
return new AutoRouterImproved(
4848
[],
4949
$namespace,
5050
$this->collection->getDefaultController(),
5151
$this->collection->getDefaultMethod(),
52-
true,
53-
$httpVerb
52+
true
5453
);
5554
}
5655

@@ -84,7 +83,7 @@ public function testAutoRouteFindsModuleDefaultControllerAndMethodGet()
8483

8584
$this->collection->setDefaultController('Index');
8685

87-
$router = $this->createNewAutoRouter('GET', 'App/Controllers');
86+
$router = $this->createNewAutoRouter('App/Controllers');
8887

8988
[$directory, $controller, $method, $params]
9089
= $router->getRoute('test', 'GET');
@@ -99,7 +98,7 @@ public function testAutoRouteFindsDefaultControllerAndMethodPost(): void
9998
{
10099
$this->collection->setDefaultController('Index');
101100

102-
$router = $this->createNewAutoRouter('post');
101+
$router = $this->createNewAutoRouter();
103102

104103
[$directory, $controller, $method, $params]
105104
= $router->getRoute('/', 'POST');

0 commit comments

Comments
 (0)