Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17eba51

Browse files
authored
Refine RouteParserInterface type annotations. (#3400)
1 parent5cb7734 commit17eba51

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

‎Slim/Interfaces/RouteParserInterface.php‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ interface RouteParserInterface
2020
/**
2121
* Build the path for a named route excluding the base path
2222
*
23-
* @param string $routeName Route name
24-
* @param array<string, string> $data Named argument replacement data
25-
* @param array<string, string> $queryParams Optional query string parameters
23+
* @param string$routeName Route name
24+
* @param array<string, string>$data Named argument replacement data
25+
* @param array<string, string | array<array-key, string>> $queryParams Optional query string parameters
2626
*
2727
* @throws RuntimeException If named route does not exist
2828
* @throws InvalidArgumentException If required data not provided
@@ -32,9 +32,9 @@ public function relativeUrlFor(string $routeName, array $data = [], array $query
3232
/**
3333
* Build the path for a named route including the base path
3434
*
35-
* @param string $routeName Route name
36-
* @param array<string, string> $data Named argument replacement data
37-
* @param array<string, string> $queryParams Optional query string parameters
35+
* @param string$routeName Route name
36+
* @param array<string, string>$data Named argument replacement data
37+
* @param array<string, string | array<array-key, string>> $queryParams Optional query string parameters
3838
*
3939
* @throws RuntimeException If named route does not exist
4040
* @throws InvalidArgumentException If required data not provided
@@ -44,10 +44,10 @@ public function urlFor(string $routeName, array $data = [], array $queryParams =
4444
/**
4545
* Get fully qualified URL for named route
4646
*
47-
* @param UriInterface $uri
48-
* @param string $routeName Route name
49-
* @param array<string, string> $data Named argument replacement data
50-
* @param array<string, string> $queryParams Optional query string parameters
47+
* @param UriInterface$uri
48+
* @param string$routeName Route name
49+
* @param array<string, string>$data Named argument replacement data
50+
* @param array<string, string | array<array-key, string>> $queryParams Optional query string parameters
5151
*/
5252
publicfunctionfullUrlFor(UriInterface$uri,string$routeName,array$data = [],array$queryParams = []):string;
5353
}

‎tests/Routing/RouteParserTest.php‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,27 @@ public function urlForCases()
3434
[],
3535
'/hello/world',
3636
],
37-
'without query parameters' => [
37+
'with query parameters' => [
3838
false,
3939
'/{first}/{second}',
4040
['first' =>'hello','second' =>'world'],
4141
['a' =>'b','c' =>'d'],
4242
'/hello/world?a=b&c=d',
4343
],
44+
'with query parameters containing array with string keys' => [
45+
false,
46+
'/{first}/{second}',
47+
['first' =>'hello','second' =>'world'],
48+
['a' => ['k' =>'1','f' =>'x'],'b','c' =>'d'],
49+
'/hello/world?a%5Bk%5D=1&a%5Bf%5D=x&0=b&c=d',
50+
],
51+
'with query parameters containing array with numeric keys' => [
52+
false,
53+
'/{first}/{second}',
54+
['first' =>'hello','second' =>'world'],
55+
['a' => ['b','x','y'],'c' =>'d'],
56+
'/hello/world?a%5B0%5D=b&a%5B1%5D=x&a%5B2%5D=y&c=d',
57+
],
4458
'with argument without optional parameter' => [
4559
false,
4660
'/archive/{year}[/{month:[\d:{2}]}[/d/{day}]]',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp