Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove the ignore errors of Router in phpstan. #7802

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -1171,11 +1171,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Model.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/AutoRouter.php',
];
$ignoreErrors[] = [
'message' => '#^Property CodeIgniter\\\\Router\\\\AutoRouter\\:\\:\\$cliRoutes type has no signature specified for Closure\\.$#',
'count' => 1,
Expand All @@ -1191,11 +1186,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
'count' => 1,
Expand All @@ -1206,11 +1196,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:discoverRoutes\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:environment\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#',
'count' => 1,
Expand All @@ -1231,11 +1216,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has parameter \\$params with no signature specified for callable\\.$#',
'count' => 1,
Expand Down Expand Up @@ -1271,11 +1251,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:resetRoutes\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/RouteCollection.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:set404Override\\(\\) has parameter \\$callable with no signature specified for callable\\.$#',
'count' => 1,
Expand Down Expand Up @@ -1341,11 +1316,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Router/Router.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:autoRoute\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/Router.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:controllerName\\(\\) return type has no signature specified for Closure\\.$#',
'count' => 1,
Expand All @@ -1361,26 +1331,11 @@
'count' => 1,
'path' => __DIR__ . '/system/Router/Router.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDefaultController\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/Router.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/Router.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setMatchedRoute\\(\\) has parameter \\$handler with no signature specified for callable\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/Router.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setRequest\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Router/Router.php',
];
$ignoreErrors[] = [
'message' => '#^Property CodeIgniter\\\\Router\\\\Router\\:\\:\\$controller type has no signature specified for Closure\\.$#',
'count' => 1,
Expand Down
2 changes: 2 additions & 0 deletions system/Router/AutoRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ private function isValidSegment(string $segment): bool
* @param bool $validate if true, checks to make sure $dir consists of only PSR4 compliant segments
*
* @deprecated This method should be removed.
*
* @return void
*/
public function setDirectory(?string $dir = null, bool $append = false, bool $validate = true)
{
Expand Down
8 changes: 8 additions & 0 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ public function loadRoutes(string $routesFile = APPPATH . 'Config/Routes.php')
/**
* Will attempt to discover any additional routes, either through
* the local PSR4 namespaces, or through selected Composer packages.
*
* @return void
*/
protected function discoverRoutes()
{
Expand Down Expand Up @@ -659,6 +661,8 @@ public function getRedirectCode(string $from): int
*
* @param string $name The name to group/prefix the routes with.
* @param array|callable ...$params
*
* @return void
*/
public function group(string $name, ...$params)
{
Expand Down Expand Up @@ -1291,6 +1295,8 @@ private function replaceLocale(string $route, ?string $locale = null): string
* by a pipe character "|" if there is more than one.
*
* @param array|Closure|string $to
*
* @return void
*/
protected function create(string $verb, string $from, $to, ?array $options = null)
{
Expand Down Expand Up @@ -1536,6 +1542,8 @@ private function determineCurrentSubdomain()
/**
* Reset the routes, so that a test case can provide the
* explicit ones needed for it.
*
* @return void
*/
public function resetRoutes()
{
Expand Down
8 changes: 8 additions & 0 deletions system/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ protected function checkRoutes(string $uri): bool
*
* Attempts to match a URI path against Controllers and directories
* found in APPPATH/Controllers, to find a matching route.
*
* @return void
*/
public function autoRoute(string $uri)
{
Expand Down Expand Up @@ -579,6 +581,8 @@ protected function scanControllers(array $segments): array
*
* @param bool $validate if true, checks to make sure $dir consists of only PSR4 compliant segments
*
* @return void
*
* @deprecated This method should be removed.
*/
public function setDirectory(?string $dir = null, bool $append = false, bool $validate = true)
Expand Down Expand Up @@ -611,6 +615,8 @@ private function isValidSegment(string $segment): bool
* to be called.
*
* @param array $segments URI segments
*
* @return void
*/
protected function setRequest(array $segments = [])
{
Expand Down Expand Up @@ -638,6 +644,8 @@ protected function setRequest(array $segments = [])
* Sets the default controller based on the info set in the RouteCollection.
*
* @deprecated This was an unnecessary method, so it is no longer used.
*
* @return void
*/
protected function setDefaultController()
{
Expand Down