Skip to content

Commit 8fbe586

Browse files
authored
Merge pull request #8505 from kenjis/fix-phpdocs
docs: fix PHPDocs
2 parents d6d571b + 267d6c0 commit 8fbe586

File tree

9 files changed

+37
-140
lines changed

9 files changed

+37
-140
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,11 +2491,6 @@
24912491
'count' => 1,
24922492
'path' => __DIR__ . '/system/Router/AutoRouter.php',
24932493
];
2494-
$ignoreErrors[] = [
2495-
'message' => '#^Property CodeIgniter\\\\Router\\\\AutoRouter\\:\\:\\$cliRoutes type has no signature specified for Closure\\.$#',
2496-
'count' => 1,
2497-
'path' => __DIR__ . '/system/Router/AutoRouter.php',
2498-
];
24992494
$ignoreErrors[] = [
25002495
'message' => '#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#',
25012496
'count' => 1,
@@ -2516,81 +2511,16 @@
25162511
'count' => 6,
25172512
'path' => __DIR__ . '/system/Router/RouteCollection.php',
25182513
];
2519-
$ignoreErrors[] = [
2520-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:add\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2521-
'count' => 1,
2522-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2523-
];
2524-
$ignoreErrors[] = [
2525-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:cli\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2526-
'count' => 1,
2527-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2528-
];
2529-
$ignoreErrors[] = [
2530-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:create\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2531-
'count' => 1,
2532-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2533-
];
2534-
$ignoreErrors[] = [
2535-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:delete\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2536-
'count' => 1,
2537-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2538-
];
25392514
$ignoreErrors[] = [
25402515
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:environment\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#',
25412516
'count' => 1,
25422517
'path' => __DIR__ . '/system/Router/RouteCollection.php',
25432518
];
2544-
$ignoreErrors[] = [
2545-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:get\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2546-
'count' => 1,
2547-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2548-
];
2549-
$ignoreErrors[] = [
2550-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:get404Override\\(\\) return type has no signature specified for Closure\\.$#',
2551-
'count' => 1,
2552-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2553-
];
2554-
$ignoreErrors[] = [
2555-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:getControllerName\\(\\) has parameter \\$handler with no signature specified for Closure\\.$#',
2556-
'count' => 1,
2557-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2558-
];
25592519
$ignoreErrors[] = [
25602520
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:group\\(\\) has parameter \\$params with no signature specified for callable\\.$#',
25612521
'count' => 1,
25622522
'path' => __DIR__ . '/system/Router/RouteCollection.php',
25632523
];
2564-
$ignoreErrors[] = [
2565-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:head\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2566-
'count' => 1,
2567-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2568-
];
2569-
$ignoreErrors[] = [
2570-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:match\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2571-
'count' => 1,
2572-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2573-
];
2574-
$ignoreErrors[] = [
2575-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:options\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2576-
'count' => 1,
2577-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2578-
];
2579-
$ignoreErrors[] = [
2580-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:patch\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2581-
'count' => 1,
2582-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2583-
];
2584-
$ignoreErrors[] = [
2585-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:post\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2586-
'count' => 1,
2587-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2588-
];
2589-
$ignoreErrors[] = [
2590-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:put\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2591-
'count' => 1,
2592-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2593-
];
25942524
$ignoreErrors[] = [
25952525
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollection\\:\\:set404Override\\(\\) has parameter \\$callable with no signature specified for callable\\.$#',
25962526
'count' => 1,
@@ -2611,21 +2541,6 @@
26112541
'count' => 1,
26122542
'path' => __DIR__ . '/system/Router/RouteCollection.php',
26132543
];
2614-
$ignoreErrors[] = [
2615-
'message' => '#^Property CodeIgniter\\\\Router\\\\RouteCollection\\:\\:\\$override404 type has no signature specified for Closure\\.$#',
2616-
'count' => 1,
2617-
'path' => __DIR__ . '/system/Router/RouteCollection.php',
2618-
];
2619-
$ignoreErrors[] = [
2620-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:add\\(\\) has parameter \\$to with no signature specified for Closure\\.$#',
2621-
'count' => 1,
2622-
'path' => __DIR__ . '/system/Router/RouteCollectionInterface.php',
2623-
];
2624-
$ignoreErrors[] = [
2625-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:get404Override\\(\\) return type has no signature specified for Closure\\.$#',
2626-
'count' => 1,
2627-
'path' => __DIR__ . '/system/Router/RouteCollectionInterface.php',
2628-
];
26292544
$ignoreErrors[] = [
26302545
'message' => '#^Method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:set404Override\\(\\) has parameter \\$callable with no signature specified for callable\\.$#',
26312546
'count' => 1,
@@ -2681,41 +2596,16 @@
26812596
'count' => 1,
26822597
'path' => __DIR__ . '/system/Router/Router.php',
26832598
];
2684-
$ignoreErrors[] = [
2685-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:controllerName\\(\\) return type has no signature specified for Closure\\.$#',
2686-
'count' => 1,
2687-
'path' => __DIR__ . '/system/Router/Router.php',
2688-
];
26892599
$ignoreErrors[] = [
26902600
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:get404Override\\(\\) has no return type specified\\.$#',
26912601
'count' => 1,
26922602
'path' => __DIR__ . '/system/Router/Router.php',
26932603
];
2694-
$ignoreErrors[] = [
2695-
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:handle\\(\\) return type has no signature specified for Closure\\.$#',
2696-
'count' => 1,
2697-
'path' => __DIR__ . '/system/Router/Router.php',
2698-
];
26992604
$ignoreErrors[] = [
27002605
'message' => '#^Method CodeIgniter\\\\Router\\\\Router\\:\\:setMatchedRoute\\(\\) has parameter \\$handler with no signature specified for callable\\.$#',
27012606
'count' => 1,
27022607
'path' => __DIR__ . '/system/Router/Router.php',
27032608
];
2704-
$ignoreErrors[] = [
2705-
'message' => '#^Property CodeIgniter\\\\Router\\\\Router\\:\\:\\$controller type has no signature specified for Closure\\.$#',
2706-
'count' => 1,
2707-
'path' => __DIR__ . '/system/Router/Router.php',
2708-
];
2709-
$ignoreErrors[] = [
2710-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouterInterface\\:\\:controllerName\\(\\) return type has no signature specified for Closure\\.$#',
2711-
'count' => 1,
2712-
'path' => __DIR__ . '/system/Router/RouterInterface.php',
2713-
];
2714-
$ignoreErrors[] = [
2715-
'message' => '#^Method CodeIgniter\\\\Router\\\\RouterInterface\\:\\:handle\\(\\) return type has no signature specified for Closure\\.$#',
2716-
'count' => 1,
2717-
'path' => __DIR__ . '/system/Router/RouterInterface.php',
2718-
];
27192609
$ignoreErrors[] = [
27202610
'message' => '#^Method CodeIgniter\\\\Session\\\\Exceptions\\\\SessionException\\:\\:forEmptySavepath\\(\\) has no return type specified\\.$#',
27212611
'count' => 1,

system/Database/BaseBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ public function upsertBatch($set = null, ?bool $escape = null, int $batchSize =
19681968
/**
19691969
* Generates a platform-specific upsertBatch string from the supplied data
19701970
*
1971-
* @used-by batchExecute
1971+
* @used-by batchExecute()
19721972
*
19731973
* @param string $table Protected table name
19741974
* @param list<string> $keys QBKeys
@@ -2195,7 +2195,7 @@ public function insertBatch($set = null, ?bool $escape = null, int $batchSize =
21952195
/**
21962196
* Generates a platform-specific insert string from the supplied data.
21972197
*
2198-
* @used-by batchExecute
2198+
* @used-by batchExecute()
21992199
*
22002200
* @param string $table Protected table name
22012201
* @param list<string> $keys QBKeys
@@ -2563,7 +2563,7 @@ public function updateBatch($set = null, $constraints = null, int $batchSize = 1
25632563
/**
25642564
* Generates a platform-specific batch update string from the supplied data
25652565
*
2566-
* @used-by batchExecute
2566+
* @used-by batchExecute()
25672567
*
25682568
* @param string $table Protected table name
25692569
* @param list<string> $keys QBKeys
@@ -2825,7 +2825,7 @@ public function deleteBatch($set = null, $constraints = null, int $batchSize = 1
28252825
/**
28262826
* Generates a platform-specific batch update string from the supplied data
28272827
*
2828-
* @used-by batchExecute
2828+
* @used-by batchExecute()
28292829
*
28302830
* @param string $table Protected table name
28312831
* @param list<string> $keys QBKeys

system/Database/Postgre/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public function join(string $table, $cond, string $type = '', ?bool $escape = nu
315315
/**
316316
* Generates a platform-specific batch update string from the supplied data
317317
*
318-
* @used-by batchExecute
318+
* @used-by batchExecute()
319319
*
320320
* @param string $table Protected table name
321321
* @param list<string> $keys QBKeys

system/Email/Email.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,9 @@ protected function unwrapSpecials()
16651665
/**
16661666
* Strip line-breaks via callback
16671667
*
1668-
* @param string $matches
1668+
* @used-by unwrapSpecials()
1669+
*
1670+
* @param list<string> $matches
16691671
*
16701672
* @return string
16711673
*/

system/Router/AutoRouter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Closure;
1515
use CodeIgniter\Exceptions\PageNotFoundException;
16+
use CodeIgniter\HTTP\ResponseInterface;
1617

1718
/**
1819
* Router for Auto-Routing
@@ -22,7 +23,7 @@ final class AutoRouter implements AutoRouterInterface
2223
/**
2324
* List of CLI routes that do not contain '*' routes.
2425
*
25-
* @var array<string, Closure|string> [routeKey => handler]
26+
* @var array<string, (Closure(mixed...): (ResponseInterface|string|void))|string> [routeKey => handler]
2627
*/
2728
private array $cliRoutes;
2829

system/Router/RouteCollection.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Closure;
1515
use CodeIgniter\Autoloader\FileLocator;
16+
use CodeIgniter\HTTP\ResponseInterface;
1617
use CodeIgniter\Router\Exceptions\RouterException;
1718
use Config\App;
1819
use Config\Modules;
@@ -87,7 +88,7 @@ class RouteCollection implements RouteCollectionInterface
8788
* A callable that will be shown
8889
* when the route cannot be matched.
8990
*
90-
* @var Closure|string
91+
* @var (Closure(string): (ResponseInterface|string|void))|string
9192
*/
9293
protected $override404;
9394

@@ -497,7 +498,7 @@ public function set404Override($callable = null): RouteCollectionInterface
497498
* Returns the 404 Override setting, which can be null, a closure
498499
* or the controller/string.
499500
*
500-
* @return Closure|string|null
501+
* @return (Closure(string): (ResponseInterface|string|void))|string|null
501502
*/
502503
public function get404Override()
503504
{
@@ -658,7 +659,7 @@ public function map(array $routes = [], ?array $options = null): RouteCollection
658659
* Example:
659660
* $routes->add('news', 'Posts::index');
660661
*
661-
* @param array|Closure|string $to
662+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
662663
*/
663664
public function add(string $from, $to, ?array $options = null): RouteCollectionInterface
664665
{
@@ -992,7 +993,7 @@ public function presenter(string $name, ?array $options = null): RouteCollection
992993
* Example:
993994
* $route->match( ['get', 'post'], 'users/(:num)', 'users/$1);
994995
*
995-
* @param array|Closure|string $to
996+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
996997
*/
997998
public function match(array $verbs = [], string $from = '', $to = '', ?array $options = null): RouteCollectionInterface
998999
{
@@ -1012,7 +1013,7 @@ public function match(array $verbs = [], string $from = '', $to = '', ?array $op
10121013
/**
10131014
* Specifies a route that is only available to GET requests.
10141015
*
1015-
* @param array|Closure|string $to
1016+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
10161017
*/
10171018
public function get(string $from, $to, ?array $options = null): RouteCollectionInterface
10181019
{
@@ -1024,7 +1025,7 @@ public function get(string $from, $to, ?array $options = null): RouteCollectionI
10241025
/**
10251026
* Specifies a route that is only available to POST requests.
10261027
*
1027-
* @param array|Closure|string $to
1028+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
10281029
*/
10291030
public function post(string $from, $to, ?array $options = null): RouteCollectionInterface
10301031
{
@@ -1036,7 +1037,7 @@ public function post(string $from, $to, ?array $options = null): RouteCollection
10361037
/**
10371038
* Specifies a route that is only available to PUT requests.
10381039
*
1039-
* @param array|Closure|string $to
1040+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
10401041
*/
10411042
public function put(string $from, $to, ?array $options = null): RouteCollectionInterface
10421043
{
@@ -1048,7 +1049,7 @@ public function put(string $from, $to, ?array $options = null): RouteCollectionI
10481049
/**
10491050
* Specifies a route that is only available to DELETE requests.
10501051
*
1051-
* @param array|Closure|string $to
1052+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
10521053
*/
10531054
public function delete(string $from, $to, ?array $options = null): RouteCollectionInterface
10541055
{
@@ -1060,7 +1061,7 @@ public function delete(string $from, $to, ?array $options = null): RouteCollecti
10601061
/**
10611062
* Specifies a route that is only available to HEAD requests.
10621063
*
1063-
* @param array|Closure|string $to
1064+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
10641065
*/
10651066
public function head(string $from, $to, ?array $options = null): RouteCollectionInterface
10661067
{
@@ -1072,7 +1073,7 @@ public function head(string $from, $to, ?array $options = null): RouteCollection
10721073
/**
10731074
* Specifies a route that is only available to PATCH requests.
10741075
*
1075-
* @param array|Closure|string $to
1076+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
10761077
*/
10771078
public function patch(string $from, $to, ?array $options = null): RouteCollectionInterface
10781079
{
@@ -1084,7 +1085,7 @@ public function patch(string $from, $to, ?array $options = null): RouteCollectio
10841085
/**
10851086
* Specifies a route that is only available to OPTIONS requests.
10861087
*
1087-
* @param array|Closure|string $to
1088+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
10881089
*/
10891090
public function options(string $from, $to, ?array $options = null): RouteCollectionInterface
10901091
{
@@ -1096,7 +1097,7 @@ public function options(string $from, $to, ?array $options = null): RouteCollect
10961097
/**
10971098
* Specifies a route that is only available to command-line requests.
10981099
*
1099-
* @param array|Closure|string $to
1100+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
11001101
*/
11011102
public function cli(string $from, $to, ?array $options = null): RouteCollectionInterface
11021103
{
@@ -1416,7 +1417,7 @@ private function replaceLocale(string $route, ?string $locale = null): string
14161417
* the request method(s) that this route will work for. They can be separated
14171418
* by a pipe character "|" if there is more than one.
14181419
*
1419-
* @param array|Closure|string $to
1420+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to
14201421
*
14211422
* @return void
14221423
*/
@@ -1767,7 +1768,7 @@ public function getRegisteredControllers(?string $verb = '*'): array
17671768
}
17681769

17691770
/**
1770-
* @param Closure|string $handler Handler
1771+
* @param (Closure(mixed...): (ResponseInterface|string|void))|string $handler Handler
17711772
*
17721773
* @return string|null Controller classname
17731774
*/

system/Router/RouteCollectionInterface.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace CodeIgniter\Router;
1313

1414
use Closure;
15+
use CodeIgniter\HTTP\ResponseInterface;
1516

1617
/**
1718
* Interface RouteCollectionInterface
@@ -28,9 +29,9 @@ interface RouteCollectionInterface
2829
/**
2930
* Adds a single route to the collection.
3031
*
31-
* @param string $from The route path (with placeholders or regex)
32-
* @param array|Closure|string $to The route handler
33-
* @param array|null $options The route options
32+
* @param string $from The route path (with placeholders or regex)
33+
* @param array|(Closure(mixed...): (ResponseInterface|string|void))|string $to The route handler
34+
* @param array|null $options The route options
3435
*
3536
* @return RouteCollectionInterface
3637
*/
@@ -111,7 +112,7 @@ public function set404Override($callable = null): self;
111112
* Returns the 404 Override setting, which can be null, a closure
112113
* or the controller/string.
113114
*
114-
* @return Closure|string|null
115+
* @return (Closure(string): (ResponseInterface|string|void))|string|null
115116
*/
116117
public function get404Override();
117118

0 commit comments

Comments
 (0)