Skip to content

Commit ee34c18

Browse files
committed
Fix: Remove the ignore errors of Router in phpstan.
1 parent 6dfc38b commit ee34c18

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
@@ -1171,11 +1171,6 @@
11711171
'count' => 1,
11721172
'path' => __DIR__ . '/system/Model.php',
11731173
];
1174-
$ignoreErrors[] = [
1175-
'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
1176-
'count' => 1,
1177-
'path' => __DIR__ . '/system/Router/AutoRouter.php',
1178-
];
11791174
$ignoreErrors[] = [
11801175
'message' => '#^Property CodeIgniter\\\\Router\\\\AutoRouter\\:\\:\\$cliRoutes type has no signature specified for Closure\\.$#',
11811176
'count' => 1,
@@ -1191,11 +1186,6 @@
11911186
'count' => 1,
11921187
'path' => __DIR__ . '/system/Router/RouteCollection.php',
11931188
];
1194-
$ignoreErrors[] = [
1195-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has no return type specified\\.$#',
1196-
'count' => 1,
1197-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1198-
];
11991189
$ignoreErrors[] = [
12001190
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
12011191
'count' => 1,
@@ -1206,11 +1196,6 @@
12061196
'count' => 1,
12071197
'path' => __DIR__ . '/system/Router/RouteCollection.php',
12081198
];
1209-
$ignoreErrors[] = [
1210-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:discoverRoutes\\(\\) has no return type specified\\.$#',
1211-
'count' => 1,
1212-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1213-
];
12141199
$ignoreErrors[] = [
12151200
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:environment\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#',
12161201
'count' => 1,
@@ -1231,11 +1216,6 @@
12311216
'count' => 1,
12321217
'path' => __DIR__ . '/system/Router/RouteCollection.php',
12331218
];
1234-
$ignoreErrors[] = [
1235-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has no return type specified\\.$#',
1236-
'count' => 1,
1237-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1238-
];
12391219
$ignoreErrors[] = [
12401220
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has parameter \\$params with no signature specified for callable\\.$#',
12411221
'count' => 1,
@@ -1271,11 +1251,6 @@
12711251
'count' => 1,
12721252
'path' => __DIR__ . '/system/Router/RouteCollection.php',
12731253
];
1274-
$ignoreErrors[] = [
1275-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:resetRoutes\\(\\) has no return type specified\\.$#',
1276-
'count' => 1,
1277-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
1278-
];
12791254
$ignoreErrors[] = [
12801255
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:set404Override\\(\\) has parameter \\$callable with no signature specified for callable\\.$#',
12811256
'count' => 1,
@@ -1341,11 +1316,6 @@
13411316
'count' => 1,
13421317
'path' => __DIR__ . '/system/Router/Router.php',
13431318
];
1344-
$ignoreErrors[] = [
1345-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:autoRoute\\(\\) has no return type specified\\.$#',
1346-
'count' => 1,
1347-
'path' => __DIR__ . '/system/Router/Router.php',
1348-
];
13491319
$ignoreErrors[] = [
13501320
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:controllerName\\(\\) return type has no signature specified for Closure\\.$#',
13511321
'count' => 1,
@@ -1361,26 +1331,11 @@
13611331
'count' => 1,
13621332
'path' => __DIR__ . '/system/Router/Router.php',
13631333
];
1364-
$ignoreErrors[] = [
1365-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDefaultController\\(\\) has no return type specified\\.$#',
1366-
'count' => 1,
1367-
'path' => __DIR__ . '/system/Router/Router.php',
1368-
];
1369-
$ignoreErrors[] = [
1370-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
1371-
'count' => 1,
1372-
'path' => __DIR__ . '/system/Router/Router.php',
1373-
];
13741334
$ignoreErrors[] = [
13751335
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setMatchedRoute\\(\\) has parameter \\$handler with no signature specified for callable\\.$#',
13761336
'count' => 1,
13771337
'path' => __DIR__ . '/system/Router/Router.php',
13781338
];
1379-
$ignoreErrors[] = [
1380-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setRequest\\(\\) has no return type specified\\.$#',
1381-
'count' => 1,
1382-
'path' => __DIR__ . '/system/Router/Router.php',
1383-
];
13841339
$ignoreErrors[] = [
13851340
'message' => '#^Property CodeIgniter\\\\Router\\\\Router\\:\\:\\$controller type has no signature specified for Closure\\.$#',
13861341
'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)