@@ -51,7 +51,7 @@ class RouteCollection implements \Countable, \JsonSerializable
51
51
* `{scheme}://{hostname}[:{port}]`
52
52
* @param string|null $name The collection name
53
53
*/
54
- public function __construct (Router $ router , string $ origin , string $ name = null )
54
+ public function __construct (Router $ router , string $ origin , ? string $ name = null )
55
55
{
56
56
$ this ->router = $ router ;
57
57
$ this ->setOrigin ($ origin );
@@ -206,7 +206,7 @@ protected function getRouteNotFound() : ?Route
206
206
*
207
207
* @param array<int,string> $httpMethods The HTTP Methods
208
208
* @param string $path The URL path
209
- * @param array<int,string>|Closure |string $action The Route action
209
+ * @param Closure| array<int,string>|string $action The Route action
210
210
* @param string|null $name The Route name
211
211
*
212
212
* @see Method::DELETE
@@ -221,8 +221,8 @@ protected function getRouteNotFound() : ?Route
221
221
public function add (
222
222
array $ httpMethods ,
223
223
string $ path ,
224
- array | Closure | string $ action ,
225
- string $ name = null
224
+ Closure | array | string $ action ,
225
+ ? string $ name = null
226
226
) : Route {
227
227
$ route = $ this ->makeRoute ($ path , $ action , $ name );
228
228
foreach ($ httpMethods as $ method ) {
@@ -233,15 +233,15 @@ public function add(
233
233
234
234
/**
235
235
* @param string $path
236
- * @param array<int,string>|Closure |string $action
236
+ * @param Closure| array<int,string>|string $action
237
237
* @param string|null $name
238
238
*
239
239
* @return Route
240
240
*/
241
241
protected function makeRoute (
242
242
string $ path ,
243
- array | Closure | string $ action ,
244
- string $ name = null
243
+ Closure | array | string $ action ,
244
+ ? string $ name = null
245
245
) : Route {
246
246
if (\is_array ($ action )) {
247
247
$ action = $ this ->makeRouteActionFromArray ($ action );
@@ -256,16 +256,16 @@ protected function makeRoute(
256
256
/**
257
257
* @param string $method
258
258
* @param string $path
259
- * @param array<int,string>|Closure |string $action
259
+ * @param Closure| array<int,string>|string $action
260
260
* @param string|null $name
261
261
*
262
262
* @return Route
263
263
*/
264
264
protected function addSimple (
265
265
string $ method ,
266
266
string $ path ,
267
- array | Closure | string $ action ,
268
- string $ name = null
267
+ Closure | array | string $ action ,
268
+ ? string $ name = null
269
269
) : Route {
270
270
return $ this ->routes [$ method ][] = $ this ->makeRoute ($ path , $ action , $ name );
271
271
}
@@ -298,7 +298,7 @@ protected function makeRouteActionFromArray(array $action) : string
298
298
* Adds a Route to match the HTTP GET Method.
299
299
*
300
300
* @param string $path The URL path
301
- * @param array<int,string>|Closure |string $action The Route action
301
+ * @param Closure| array<int,string>|string $action The Route action
302
302
* @param string|null $name The Route name
303
303
*
304
304
* @see Method::GET
@@ -307,8 +307,8 @@ protected function makeRouteActionFromArray(array $action) : string
307
307
*/
308
308
public function get (
309
309
string $ path ,
310
- array | Closure | string $ action ,
311
- string $ name = null
310
+ Closure | array | string $ action ,
311
+ ? string $ name = null
312
312
) : Route {
313
313
return $ this ->addSimple ('GET ' , $ path , $ action , $ name );
314
314
}
@@ -317,7 +317,7 @@ public function get(
317
317
* Adds a Route to match the HTTP POST Method.
318
318
*
319
319
* @param string $path The URL path
320
- * @param array<int,string>|Closure |string $action The Route action
320
+ * @param Closure| array<int,string>|string $action The Route action
321
321
* @param string|null $name The Route name
322
322
*
323
323
* @see Method::POST
@@ -326,8 +326,8 @@ public function get(
326
326
*/
327
327
public function post (
328
328
string $ path ,
329
- array | Closure | string $ action ,
330
- string $ name = null
329
+ Closure | array | string $ action ,
330
+ ? string $ name = null
331
331
) : Route {
332
332
return $ this ->addSimple ('POST ' , $ path , $ action , $ name );
333
333
}
@@ -336,7 +336,7 @@ public function post(
336
336
* Adds a Route to match the HTTP PUT Method.
337
337
*
338
338
* @param string $path The URL path
339
- * @param array<int,string>|Closure |string $action The Route action
339
+ * @param Closure| array<int,string>|string $action The Route action
340
340
* @param string|null $name The Route name
341
341
*
342
342
* @see Method::PUT
@@ -345,8 +345,8 @@ public function post(
345
345
*/
346
346
public function put (
347
347
string $ path ,
348
- array | Closure | string $ action ,
349
- string $ name = null
348
+ Closure | array | string $ action ,
349
+ ? string $ name = null
350
350
) : Route {
351
351
return $ this ->addSimple ('PUT ' , $ path , $ action , $ name );
352
352
}
@@ -355,7 +355,7 @@ public function put(
355
355
* Adds a Route to match the HTTP PATCH Method.
356
356
*
357
357
* @param string $path The URL path
358
- * @param array<int,string>|Closure |string $action The Route action
358
+ * @param Closure| array<int,string>|string $action The Route action
359
359
* @param string|null $name The Route name
360
360
*
361
361
* @see Method::PATCH
@@ -364,8 +364,8 @@ public function put(
364
364
*/
365
365
public function patch (
366
366
string $ path ,
367
- array | Closure | string $ action ,
368
- string $ name = null
367
+ Closure | array | string $ action ,
368
+ ? string $ name = null
369
369
) : Route {
370
370
return $ this ->addSimple ('PATCH ' , $ path , $ action , $ name );
371
371
}
@@ -374,7 +374,7 @@ public function patch(
374
374
* Adds a Route to match the HTTP DELETE Method.
375
375
*
376
376
* @param string $path The URL path
377
- * @param array<int,string>|Closure |string $action The Route action
377
+ * @param Closure| array<int,string>|string $action The Route action
378
378
* @param string|null $name The Route name
379
379
*
380
380
* @see Method::DELETE
@@ -383,8 +383,8 @@ public function patch(
383
383
*/
384
384
public function delete (
385
385
string $ path ,
386
- array | Closure | string $ action ,
387
- string $ name = null
386
+ Closure | array | string $ action ,
387
+ ? string $ name = null
388
388
) : Route {
389
389
return $ this ->addSimple ('DELETE ' , $ path , $ action , $ name );
390
390
}
@@ -393,7 +393,7 @@ public function delete(
393
393
* Adds a Route to match the HTTP OPTIONS Method.
394
394
*
395
395
* @param string $path The URL path
396
- * @param array<int,string>|Closure |string $action The Route action
396
+ * @param Closure| array<int,string>|string $action The Route action
397
397
* @param string|null $name The Route name
398
398
*
399
399
* @see Method::OPTIONS
@@ -402,8 +402,8 @@ public function delete(
402
402
*/
403
403
public function options (
404
404
string $ path ,
405
- array | Closure | string $ action ,
406
- string $ name = null
405
+ Closure | array | string $ action ,
406
+ ? string $ name = null
407
407
) : Route {
408
408
return $ this ->addSimple ('OPTIONS ' , $ path , $ action , $ name );
409
409
}
@@ -422,7 +422,7 @@ public function redirect(
422
422
string $ path ,
423
423
string $ location ,
424
424
int $ code = Status::TEMPORARY_REDIRECT ,
425
- string $ name = null
425
+ ? string $ name = null
426
426
) : Route {
427
427
$ response = $ this ->router ->getResponse ();
428
428
return $ this ->addSimple (
@@ -442,10 +442,10 @@ static function (array $args) use ($response, $location, $code) : void {
442
442
* Groups many Routes into a URL path.
443
443
*
444
444
* @param string $basePath The URL path to group in
445
- * @param array<array<mixed| Route>|Route > $routes The Routes to be grouped
445
+ * @param array<Route| array<Route|mixed> > $routes The Routes to be grouped
446
446
* @param array<string,mixed> $options Custom options passed to the Routes
447
447
*
448
- * @return array<array<mixed| Route>|Route > The same $routes with updated paths and options
448
+ * @return array<Route| array<Route|mixed> > The same $routes with updated paths and options
449
449
*/
450
450
public function group (string $ basePath , array $ routes , array $ options = []) : array
451
451
{
@@ -471,9 +471,9 @@ public function group(string $basePath, array $routes, array $options = []) : ar
471
471
* Updates Routes actions, which are strings, prepending a namespace.
472
472
*
473
473
* @param string $namespace The namespace
474
- * @param array<array<mixed| Route>|Route > $routes The Routes
474
+ * @param array<Route| array<Route|mixed> > $routes The Routes
475
475
*
476
- * @return array<array<mixed| Route>|Route > The same $routes with updated actions
476
+ * @return array<Route| array<Route|mixed> > The same $routes with updated actions
477
477
*/
478
478
public function namespace (string $ namespace , array $ routes ) : array
479
479
{
0 commit comments