Skip to content

Commit 7d9f7f4

Browse files
refactor: add precise parameter types to Router test fixtures (#10464)
1 parent befd997 commit 7d9f7f4

11 files changed

Lines changed: 14 additions & 69 deletions

File tree

tests/system/Router/Controllers/BlogController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getIndex(): void
2121
{
2222
}
2323

24-
public function getSomeMethod($first = ''): void
24+
public function getSomeMethod(string $first = ''): void
2525
{
2626
}
2727
}

tests/system/Router/Controllers/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class Index extends Controller
1919
{
20-
public function getIndex($p1 = ''): void
20+
public function getIndex(string $p1 = ''): void
2121
{
2222
}
2323

tests/system/Router/Controllers/Mycontroller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getIndex(): void
2121
{
2222
}
2323

24-
public function getSomemethod($first = ''): void
24+
public function getSomemethod(string $first = ''): void
2525
{
2626
}
2727
}

tests/system/Router/Controllers/Remap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class Remap extends Controller
2020
{
21-
public function _remap(string $method, ...$params): string
21+
public function _remap(string $method, mixed ...$params): string
2222
{
2323
$method = 'process_' . $method;
2424

tests/system/Router/Controllers/SubDir/BlogController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getIndex(): void
2121
{
2222
}
2323

24-
public function getSomeMethod($first = ''): void
24+
public function getSomeMethod(string $first = ''): void
2525
{
2626
}
2727
}

tests/system/Router/Controllers/Subfolder/Home.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class Home extends Controller
1919
{
20-
public function getIndex($p1 = null, $p2 = null): void
20+
public function getIndex(?string $p1 = null, ?string $p2 = null): void
2121
{
2222
}
2323
}

tests/system/Router/Controllers/Subfolder/Sub/BlogController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getIndex(): void
2121
{
2222
}
2323

24-
public function getSomeMethod($first = ''): void
24+
public function getSomeMethod(string $first = ''): void
2525
{
2626
}
2727
}

tests/system/Router/DefinedRouteCollectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#[Group('Others')]
2626
final class DefinedRouteCollectorTest extends CIUnitTestCase
2727
{
28-
private function createRouteCollection(array $config = [], $moduleConfig = null): RouteCollection
28+
private function createRouteCollection(array $config = [], ?Modules $moduleConfig = null): RouteCollection
2929
{
3030
$defaults = [
3131
'Config' => APPPATH . 'Config',
@@ -37,7 +37,7 @@ private function createRouteCollection(array $config = [], $moduleConfig = null)
3737

3838
$loader = service('locator');
3939

40-
if ($moduleConfig === null) {
40+
if (! $moduleConfig instanceof Modules) {
4141
$moduleConfig = new Modules();
4242
$moduleConfig->enabled = false;
4343
}

tests/system/Router/RouteCollectionReverseRouteTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function setUp(): void
3535
$this->resetFactories();
3636
}
3737

38-
protected function getCollector(array $config = [], array $files = [], $moduleConfig = null): RouteCollection
38+
protected function getCollector(array $config = [], array $files = [], ?Modules $moduleConfig = null): RouteCollection
3939
{
4040
$defaults = [
4141
'Config' => APPPATH . 'Config',
@@ -47,7 +47,7 @@ protected function getCollector(array $config = [], array $files = [], $moduleCo
4747

4848
$loader = service('locator');
4949

50-
if ($moduleConfig === null) {
50+
if (! $moduleConfig instanceof Modules) {
5151
$moduleConfig = new Modules();
5252
$moduleConfig->enabled = false;
5353
}

tests/system/Router/RouteCollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp(): void
4444
Services::injectMock('superglobals', new Superglobals());
4545
}
4646

47-
protected function getCollector(array $config = [], array $files = [], $moduleConfig = null): RouteCollection
47+
protected function getCollector(array $config = [], array $files = [], ?Modules $moduleConfig = null): RouteCollection
4848
{
4949
$defaults = [
5050
'Config' => APPPATH . 'Config',
@@ -56,7 +56,7 @@ protected function getCollector(array $config = [], array $files = [], $moduleCo
5656

5757
$loader = service('locator');
5858

59-
if ($moduleConfig === null) {
59+
if (! $moduleConfig instanceof Modules) {
6060
$moduleConfig = new Modules();
6161
$moduleConfig->enabled = false;
6262
}

0 commit comments

Comments
 (0)