Skip to content

Commit 4bd211d

Browse files
authored
Merge pull request #7802 from ya861220/230809-phpstan-Router
Fix: Remove the ignore errors of `Router` in phpstan.
2 parents 76b1e35 + ee34c18 commit 4bd211d

4 files changed

Lines changed: 18 additions & 45 deletions

File tree

phpstan-baseline.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,11 +1041,6 @@
10411041
'count' => 1,
10421042
'path' => __DIR__ . '/system/Model.php',
10431043
];
1044-
$ignoreErrors[] = [
1045-
'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
1046-
'count' => 1,
1047-
'path' => __DIR__ . '/system/Router/AutoRouter.php',
1048-
];
10491044
$ignoreErrors[] = [
10501045
'message' => '#^Property CodeIgniter\\\\Router\\\\AutoRouter\\:\\:\\$cliRoutes type has no signature specified for Closure\\.$#',
10511046
'count' => 1,
@@ -1061,11 +1056,6 @@
10611056
'count' => 1,
10621057
'path' => __DIR__ . '/system/Router/RouteCollection.php',
10631058
];
1064-
$ignoreErrors[] = [
1065-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has no return type specified\\.$#',
1066-
'count' => 1,
1067-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1068-
];
10691059
$ignoreErrors[] = [
10701060
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
10711061
'count' => 1,
@@ -1076,11 +1066,6 @@
10761066
'count' => 1,
10771067
'path' => __DIR__ . '/system/Router/RouteCollection.php',
10781068
];
1079-
$ignoreErrors[] = [
1080-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:discoverRoutes\\(\\) has no return type specified\\.$#',
1081-
'count' => 1,
1082-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1083-
];
10841069
$ignoreErrors[] = [
10851070
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:environment\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#',
10861071
'count' => 1,
@@ -1101,11 +1086,6 @@
11011086
'count' => 1,
11021087
'path' => __DIR__ . '/system/Router/RouteCollection.php',
11031088
];
1104-
$ignoreErrors[] = [
1105-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has no return type specified\\.$#',
1106-
'count' => 1,
1107-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1108-
];
11091089
$ignoreErrors[] = [
11101090
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has parameter \\$params with no signature specified for callable\\.$#',
11111091
'count' => 1,
@@ -1141,11 +1121,6 @@
11411121
'count' => 1,
11421122
'path' => __DIR__ . '/system/Router/RouteCollection.php',
11431123
];
1144-
$ignoreErrors[] = [
1145-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:resetRoutes\\(\\) has no return type specified\\.$#',
1146-
'count' => 1,
1147-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1148-
];
11491124
$ignoreErrors[] = [
11501125
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:set404Override\\(\\) has parameter \\$callable with no signature specified for callable\\.$#',
11511126
'count' => 1,
@@ -1211,11 +1186,6 @@
12111186
'count' => 1,
12121187
'path' => __DIR__ . '/system/Router/Router.php',
12131188
];
1214-
$ignoreErrors[] = [
1215-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:autoRoute\\(\\) has no return type specified\\.$#',
1216-
'count' => 1,
1217-
'path' => __DIR__ . '/system/Router/Router.php',
1218-
];
12191189
$ignoreErrors[] = [
12201190
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:controllerName\\(\\) return type has no signature specified for Closure\\.$#',
12211191
'count' => 1,
@@ -1231,26 +1201,11 @@
12311201
'count' => 1,
12321202
'path' => __DIR__ . '/system/Router/Router.php',
12331203
];
1234-
$ignoreErrors[] = [
1235-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDefaultController\\(\\) has no return type specified\\.$#',
1236-
'count' => 1,
1237-
'path' => __DIR__ . '/system/Router/Router.php',
1238-
];
1239-
$ignoreErrors[] = [
1240-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
1241-
'count' => 1,
1242-
'path' => __DIR__ . '/system/Router/Router.php',
1243-
];
12441204
$ignoreErrors[] = [
12451205
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setMatchedRoute\\(\\) has parameter \\$handler with no signature specified for callable\\.$#',
12461206
'count' => 1,
12471207
'path' => __DIR__ . '/system/Router/Router.php',
12481208
];
1249-
$ignoreErrors[] = [
1250-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setRequest\\(\\) has no return type specified\\.$#',
1251-
'count' => 1,
1252-
'path' => __DIR__ . '/system/Router/Router.php',
1253-
];
12541209
$ignoreErrors[] = [
12551210
'message' => '#^Property CodeIgniter\\\\Router\\\\Router\\:\\:\\$controller type has no signature specified for Closure\\.$#',
12561211
'count' => 1,

system/Router/AutoRouter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ private function isValidSegment(string $segment): bool
254254
* @param bool $validate if true, checks to make sure $dir consists of only PSR4 compliant segments
255255
*
256256
* @deprecated This method should be removed.
257+
*
258+
* @return void
257259
*/
258260
public function setDirectory(?string $dir = null, bool $append = false, bool $validate = true)
259261
{

system/Router/RouteCollection.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ public function loadRoutes(string $routesFile = APPPATH . 'Config/Routes.php')
274274
/**
275275
* Will attempt to discover any additional routes, either through
276276
* the local PSR4 namespaces, or through selected Composer packages.
277+
*
278+
* @return void
277279
*/
278280
protected function discoverRoutes()
279281
{
@@ -659,6 +661,8 @@ public function getRedirectCode(string $from): int
659661
*
660662
* @param string $name The name to group/prefix the routes with.
661663
* @param array|callable ...$params
664+
*
665+
* @return void
662666
*/
663667
public function group(string $name, ...$params)
664668
{
@@ -1291,6 +1295,8 @@ private function replaceLocale(string $route, ?string $locale = null): string
12911295
* by a pipe character "|" if there is more than one.
12921296
*
12931297
* @param array|Closure|string $to
1298+
*
1299+
* @return void
12941300
*/
12951301
protected function create(string $verb, string $from, $to, ?array $options = null)
12961302
{
@@ -1536,6 +1542,8 @@ private function determineCurrentSubdomain()
15361542
/**
15371543
* Reset the routes, so that a test case can provide the
15381544
* explicit ones needed for it.
1545+
*
1546+
* @return void
15391547
*/
15401548
public function resetRoutes()
15411549
{

system/Router/Router.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ protected function checkRoutes(string $uri): bool
503503
*
504504
* Attempts to match a URI path against Controllers and directories
505505
* found in APPPATH/Controllers, to find a matching route.
506+
*
507+
* @return void
506508
*/
507509
public function autoRoute(string $uri)
508510
{
@@ -579,6 +581,8 @@ protected function scanControllers(array $segments): array
579581
*
580582
* @param bool $validate if true, checks to make sure $dir consists of only PSR4 compliant segments
581583
*
584+
* @return void
585+
*
582586
* @deprecated This method should be removed.
583587
*/
584588
public function setDirectory(?string $dir = null, bool $append = false, bool $validate = true)
@@ -611,6 +615,8 @@ private function isValidSegment(string $segment): bool
611615
* to be called.
612616
*
613617
* @param array $segments URI segments
618+
*
619+
* @return void
614620
*/
615621
protected function setRequest(array $segments = [])
616622
{
@@ -638,6 +644,8 @@ protected function setRequest(array $segments = [])
638644
* Sets the default controller based on the info set in the RouteCollection.
639645
*
640646
* @deprecated This was an unnecessary method, so it is no longer used.
647+
*
648+
* @return void
641649
*/
642650
protected function setDefaultController()
643651
{

0 commit comments

Comments
 (0)