Completed
Pull Request — master (#178)
by ignace nyamagana
03:19
created
src/UriInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
         $pairs = null === $query ? [] : explode('&', $query);
79 79
         sort($pairs, SORT_REGULAR);
80 80
 
81
-        $replace = static function (array $matches): string {
81
+        $replace = static function(array $matches): string {
82 82
             return rawurldecode($matches[0]);
83 83
         };
84 84
 
Please login to merge, or discard this patch.
src/Uri.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -961,7 +961,7 @@
 block discarded – undo
961 961
             return $path;
962 962
         }
963 963
 
964
-        $replace = static function (array $matches): string {
964
+        $replace = static function(array $matches): string {
965 965
             return $matches['delim'].str_replace('|', ':', $matches['root']).$matches['rest'];
966 966
         };
967 967
 
Please login to merge, or discard this patch.
Doc Comments   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1191,10 +1191,10 @@  discard block
 block discarded – undo
1191 1191
      *
1192 1192
      * @link https://tools.ietf.org/html/rfc3986#section-5.3
1193 1193
      *
1194
-     * @param ?string $scheme
1195
-     * @param ?string $authority
1196
-     * @param ?string $query
1197
-     * @param ?string $fragment
1194
+     * @param string|null $scheme
1195
+     * @param string|null $authority
1196
+     * @param string|null $query
1197
+     * @param string|null $fragment
1198 1198
      */
1199 1199
     private function getUriString(
1200 1200
         ?string $scheme,
@@ -1330,6 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
     /**
1332 1332
      * {@inheritDoc}
1333
+     * @param string|null $scheme
1333 1334
      */
1334 1335
     public function withScheme($scheme): UriInterface
1335 1336
     {
@@ -1378,6 +1379,8 @@  discard block
 block discarded – undo
1378 1379
 
1379 1380
     /**
1380 1381
      * {@inheritDoc}
1382
+     * @param string|null $user
1383
+     * @param string $password
1381 1384
      */
1382 1385
     public function withUserInfo($user, $password = null): UriInterface
1383 1386
     {
@@ -1405,6 +1408,7 @@  discard block
 block discarded – undo
1405 1408
 
1406 1409
     /**
1407 1410
      * {@inheritDoc}
1411
+     * @param string|null $host
1408 1412
      */
1409 1413
     public function withHost($host): UriInterface
1410 1414
     {
@@ -1423,6 +1427,7 @@  discard block
 block discarded – undo
1423 1427
 
1424 1428
     /**
1425 1429
      * {@inheritDoc}
1430
+     * @param null|integer $port
1426 1431
      */
1427 1432
     public function withPort($port): UriInterface
1428 1433
     {
@@ -1441,6 +1446,7 @@  discard block
 block discarded – undo
1441 1446
 
1442 1447
     /**
1443 1448
      * {@inheritDoc}
1449
+     * @param string $path
1444 1450
      */
1445 1451
     public function withPath($path): UriInterface
1446 1452
     {
@@ -1463,6 +1469,7 @@  discard block
 block discarded – undo
1463 1469
 
1464 1470
     /**
1465 1471
      * {@inheritDoc}
1472
+     * @param string|null $query
1466 1473
      */
1467 1474
     public function withQuery($query): UriInterface
1468 1475
     {
@@ -1480,6 +1487,7 @@  discard block
 block discarded – undo
1480 1487
 
1481 1488
     /**
1482 1489
      * {@inheritDoc}
1490
+     * @param string|null $fragment
1483 1491
      */
1484 1492
     public function withFragment($fragment): UriInterface
1485 1493
     {
Please login to merge, or discard this patch.
src/UriTemplate/Expression.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
      * @link https://tools.ietf.org/html/rfc6570#appendix-A
55 55
      */
56 56
     private const OPERATOR_HASH_LOOKUP = [
57
-        ''  => ['prefix' => '',  'joiner' => ',', 'query' => false],
58
-        '+' => ['prefix' => '',  'joiner' => ',', 'query' => false],
57
+        ''  => ['prefix' => '', 'joiner' => ',', 'query' => false],
58
+        '+' => ['prefix' => '', 'joiner' => ',', 'query' => false],
59 59
         '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false],
60 60
         '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false],
61 61
         '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false],
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     private function setVariableNames(): array
105 105
     {
106
-        $mapper = static function (VarSpecifier $varSpecifier): string {
106
+        $mapper = static function(VarSpecifier $varSpecifier): string {
107 107
             return $varSpecifier->name();
108 108
         };
109 109
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
     private function setExpressionString(): string
114 114
     {
115
-        $mapper = static function (VarSpecifier $variable): string {
115
+        $mapper = static function(VarSpecifier $variable): string {
116 116
             return $variable->toString();
117 117
         };
118 118
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             throw new SyntaxError('The operator used in the expression "'.$expression.'" is reserved.');
147 147
         }
148 148
 
149
-        $mapper = static function (string $varSpec): VarSpecifier {
149
+        $mapper = static function(string $varSpec): VarSpecifier {
150 150
             return VarSpecifier::createFromString($varSpec);
151 151
         };
152 152
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $parts[] = $this->replace($varSpecifier, $variables);
178 178
         }
179 179
 
180
-        $nullFilter = static function ($value): bool {
180
+        $nullFilter = static function($value): bool {
181 181
             return '' !== $value;
182 182
         };
183 183
 
Please login to merge, or discard this patch.
tests/FtpTest.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,6 @@
 block discarded – undo
61 61
     }
62 62
 
63 63
     /**
64
-
65 64
      *
66 65
      * @dataProvider invalidUrlProvider
67 66
      */
Please login to merge, or discard this patch.
tests/HttpTest.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
172 172
             'without fragment' => [Http::createFromString('https://a:b@c:442/d?q=r')],
173 173
             'without pass' => [Http::createFromString('https://a@c:442/d?q=r#f')],
174 174
             'without authority' => [Http::createFromString('/d?q=r#f')],
175
-       ];
175
+        ];
176 176
     }
177 177
 
178 178
     /**
Please login to merge, or discard this patch.
tests/FactoryTest.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -380,44 +380,44 @@
 block discarded – undo
380 380
         $base_uri = 'http://a/b/c/d;p?q';
381 381
 
382 382
         return [
383
-            'base uri'                => [$base_uri, '',              $base_uri],
384
-            'scheme'                  => [$base_uri, 'http://d/e/f',  'http://d/e/f'],
385
-            'path 1'                  => [$base_uri, 'g',             'http://a/b/c/g'],
386
-            'path 2'                  => [$base_uri, './g',           'http://a/b/c/g'],
387
-            'path 3'                  => [$base_uri, 'g/',            'http://a/b/c/g/'],
388
-            'path 4'                  => [$base_uri, '/g',            'http://a/g'],
389
-            'authority'               => [$base_uri, '//g',           'http://g'],
390
-            'query'                   => [$base_uri, '?y',            'http://a/b/c/d;p?y'],
391
-            'path + query'            => [$base_uri, 'g?y',           'http://a/b/c/g?y'],
392
-            'fragment'                => [$base_uri, '#s',            'http://a/b/c/d;p?q#s'],
393
-            'path + fragment'         => [$base_uri, 'g#s',           'http://a/b/c/g#s'],
394
-            'path + query + fragment' => [$base_uri, 'g?y#s',         'http://a/b/c/g?y#s'],
395
-            'single dot 1'            => [$base_uri, '.',             'http://a/b/c/'],
396
-            'single dot 2'            => [$base_uri, './',            'http://a/b/c/'],
397
-            'single dot 3'            => [$base_uri, './g/.',         'http://a/b/c/g/'],
398
-            'single dot 4'            => [$base_uri, 'g/./h',         'http://a/b/c/g/h'],
399
-            'double dot 1'            => [$base_uri, '..',            'http://a/b/'],
400
-            'double dot 2'            => [$base_uri, '../',           'http://a/b/'],
401
-            'double dot 3'            => [$base_uri, '../g',          'http://a/b/g'],
402
-            'double dot 4'            => [$base_uri, '../..',         'http://a/'],
403
-            'double dot 5'            => [$base_uri, '../../',        'http://a/'],
404
-            'double dot 6'            => [$base_uri, '../../g',       'http://a/g'],
405
-            'double dot 7'            => [$base_uri, '../../../g',    'http://a/g'],
383
+            'base uri'                => [$base_uri, '', $base_uri],
384
+            'scheme'                  => [$base_uri, 'http://d/e/f', 'http://d/e/f'],
385
+            'path 1'                  => [$base_uri, 'g', 'http://a/b/c/g'],
386
+            'path 2'                  => [$base_uri, './g', 'http://a/b/c/g'],
387
+            'path 3'                  => [$base_uri, 'g/', 'http://a/b/c/g/'],
388
+            'path 4'                  => [$base_uri, '/g', 'http://a/g'],
389
+            'authority'               => [$base_uri, '//g', 'http://g'],
390
+            'query'                   => [$base_uri, '?y', 'http://a/b/c/d;p?y'],
391
+            'path + query'            => [$base_uri, 'g?y', 'http://a/b/c/g?y'],
392
+            'fragment'                => [$base_uri, '#s', 'http://a/b/c/d;p?q#s'],
393
+            'path + fragment'         => [$base_uri, 'g#s', 'http://a/b/c/g#s'],
394
+            'path + query + fragment' => [$base_uri, 'g?y#s', 'http://a/b/c/g?y#s'],
395
+            'single dot 1'            => [$base_uri, '.', 'http://a/b/c/'],
396
+            'single dot 2'            => [$base_uri, './', 'http://a/b/c/'],
397
+            'single dot 3'            => [$base_uri, './g/.', 'http://a/b/c/g/'],
398
+            'single dot 4'            => [$base_uri, 'g/./h', 'http://a/b/c/g/h'],
399
+            'double dot 1'            => [$base_uri, '..', 'http://a/b/'],
400
+            'double dot 2'            => [$base_uri, '../', 'http://a/b/'],
401
+            'double dot 3'            => [$base_uri, '../g', 'http://a/b/g'],
402
+            'double dot 4'            => [$base_uri, '../..', 'http://a/'],
403
+            'double dot 5'            => [$base_uri, '../../', 'http://a/'],
404
+            'double dot 6'            => [$base_uri, '../../g', 'http://a/g'],
405
+            'double dot 7'            => [$base_uri, '../../../g', 'http://a/g'],
406 406
             'double dot 8'            => [$base_uri, '../../../../g', 'http://a/g'],
407
-            'double dot 9'            => [$base_uri, 'g/../h' ,       'http://a/b/c/h'],
408
-            'mulitple slashes'        => [$base_uri, 'foo////g',      'http://a/b/c/foo////g'],
409
-            'complex path 1'          => [$base_uri, ';x',            'http://a/b/c/;x'],
410
-            'complex path 2'          => [$base_uri, 'g;x',           'http://a/b/c/g;x'],
411
-            'complex path 3'          => [$base_uri, 'g;x?y#s',       'http://a/b/c/g;x?y#s'],
412
-            'complex path 4'          => [$base_uri, 'g;x=1/./y',     'http://a/b/c/g;x=1/y'],
413
-            'complex path 5'          => [$base_uri, 'g;x=1/../y',    'http://a/b/c/y'],
414
-            'dot segments presence 1' => [$base_uri, '/./g',          'http://a/g'],
415
-            'dot segments presence 2' => [$base_uri, '/../g',         'http://a/g'],
416
-            'dot segments presence 3' => [$base_uri, 'g.',            'http://a/b/c/g.'],
417
-            'dot segments presence 4' => [$base_uri, '.g',            'http://a/b/c/.g'],
418
-            'dot segments presence 5' => [$base_uri, 'g..',           'http://a/b/c/g..'],
419
-            'dot segments presence 6' => [$base_uri, '..g',           'http://a/b/c/..g'],
420
-            'origin uri without path' => ['http://h:b@a', 'b/../y',   'http://h:b@a/y'],
407
+            'double dot 9'            => [$base_uri, 'g/../h', 'http://a/b/c/h'],
408
+            'mulitple slashes'        => [$base_uri, 'foo////g', 'http://a/b/c/foo////g'],
409
+            'complex path 1'          => [$base_uri, ';x', 'http://a/b/c/;x'],
410
+            'complex path 2'          => [$base_uri, 'g;x', 'http://a/b/c/g;x'],
411
+            'complex path 3'          => [$base_uri, 'g;x?y#s', 'http://a/b/c/g;x?y#s'],
412
+            'complex path 4'          => [$base_uri, 'g;x=1/./y', 'http://a/b/c/g;x=1/y'],
413
+            'complex path 5'          => [$base_uri, 'g;x=1/../y', 'http://a/b/c/y'],
414
+            'dot segments presence 1' => [$base_uri, '/./g', 'http://a/g'],
415
+            'dot segments presence 2' => [$base_uri, '/../g', 'http://a/g'],
416
+            'dot segments presence 3' => [$base_uri, 'g.', 'http://a/b/c/g.'],
417
+            'dot segments presence 4' => [$base_uri, '.g', 'http://a/b/c/.g'],
418
+            'dot segments presence 5' => [$base_uri, 'g..', 'http://a/b/c/g..'],
419
+            'dot segments presence 6' => [$base_uri, '..g', 'http://a/b/c/..g'],
420
+            'origin uri without path' => ['http://h:b@a', 'b/../y', 'http://h:b@a/y'],
421 421
             'uri without auhtority'   => ['mailto:[email protected]', '[email protected]?subject=baz', 'mailto:[email protected]?subject=baz'],
422 422
         ];
423 423
     }
Please login to merge, or discard this patch.
tests/UriTemplate/ExpressionTest.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
             'missing starting braces' => ['/id*}'],
102 102
             'multiple starting operators' => ['{/?id}'],
103 103
             'invalid prefix' => ['{var:prefix}'],
104
-            'multiple operator modifiers (1)' => ['{hello:2*}'] ,
105
-            'duplicate operator' => ['{??hello}'] ,
106
-            'reserved operator !' => ['{!hello}'] ,
104
+            'multiple operator modifiers (1)' => ['{hello:2*}'],
105
+            'duplicate operator' => ['{??hello}'],
106
+            'reserved operator !' => ['{!hello}'],
107 107
             'space inside variable name' => ['{with space}'],
108 108
             'leading space in variable name (1)' => ['{ leading_space}'],
109 109
             'trailing space in variable name' => ['{trailing_space }'],
110
-            'reserved operator =' => ['{=path}'] ,
110
+            'reserved operator =' => ['{=path}'],
111 111
             'forbidden operator $' => ['{$var}'],
112 112
             'reserved operator |' => ['{|var*}'],
113 113
             'using an operator modifier as an operator' => ['{*keys?}'],
@@ -165,83 +165,83 @@  discard block
 block discarded – undo
165 165
 
166 166
         $templateAndExpansionData = [
167 167
             'level 1' => [
168
-                ['{var}',          'value'],
169
-                ['{hello}',        'Hello%20World%21'],
170
-                ['{bool}',         '1'],
168
+                ['{var}', 'value'],
169
+                ['{hello}', 'Hello%20World%21'],
170
+                ['{bool}', '1'],
171 171
             ],
172 172
             'level 2' => [
173
-                ['{+var}',         'value'],
174
-                ['{+hello}',       'Hello%20World!'],
175
-                ['{+path}',        '/foo/bar'],
173
+                ['{+var}', 'value'],
174
+                ['{+hello}', 'Hello%20World!'],
175
+                ['{+path}', '/foo/bar'],
176 176
             ],
177 177
             'level 3' => [
178
-                ['{#var}',          '#value'],
179
-                ['{#hello}',        '#Hello%20World!'],
180
-                ['{x,y}',           '1024,768'],
181
-                ['{x,hello,y}',     '1024,Hello%20World%21,768'],
182
-                ['{+x,hello,y}',    '1024,Hello%20World!,768'],
183
-                ['{+path,x}',       '/foo/bar,1024'],
184
-                ['{#x,hello,y}',    '#1024,Hello%20World!,768'],
185
-                ['{#path,x}',       '#/foo/bar,1024'],
186
-                ['{.var}',          '.value'],
187
-                ['{.x,y}',          '.1024.768'],
188
-                ['{/var}',          '/value'],
189
-                ['{/var,x}',        '/value/1024'],
190
-                ['{;x,y}',          ';x=1024;y=768'],
191
-                ['{;x,y,empty}',    ';x=1024;y=768;empty'],
192
-                ['{?x,y}',          '?x=1024&y=768'],
193
-                ['{?x,y,empty}',    '?x=1024&y=768&empty='],
194
-                ['{?x,y,undef}',    '?x=1024&y=768'],
195
-                ['{&x}',            '&x=1024'],
196
-                ['{&x,y,empty}',    '&x=1024&y=768&empty='],
178
+                ['{#var}', '#value'],
179
+                ['{#hello}', '#Hello%20World!'],
180
+                ['{x,y}', '1024,768'],
181
+                ['{x,hello,y}', '1024,Hello%20World%21,768'],
182
+                ['{+x,hello,y}', '1024,Hello%20World!,768'],
183
+                ['{+path,x}', '/foo/bar,1024'],
184
+                ['{#x,hello,y}', '#1024,Hello%20World!,768'],
185
+                ['{#path,x}', '#/foo/bar,1024'],
186
+                ['{.var}', '.value'],
187
+                ['{.x,y}', '.1024.768'],
188
+                ['{/var}', '/value'],
189
+                ['{/var,x}', '/value/1024'],
190
+                ['{;x,y}', ';x=1024;y=768'],
191
+                ['{;x,y,empty}', ';x=1024;y=768;empty'],
192
+                ['{?x,y}', '?x=1024&y=768'],
193
+                ['{?x,y,empty}', '?x=1024&y=768&empty='],
194
+                ['{?x,y,undef}', '?x=1024&y=768'],
195
+                ['{&x}', '&x=1024'],
196
+                ['{&x,y,empty}', '&x=1024&y=768&empty='],
197 197
             ],
198 198
             'level 4' => [
199
-                ['{var:3}',         'val'],
200
-                ['{var:30}',        'value'],
201
-                ['{list}',          'red,green,blue'],
202
-                ['{list*}',         'red,green,blue'],
203
-                ['{keys}',          'semi,%3B,dot,.,comma,%2C'],
204
-                ['{keys*}',         'semi=%3B,dot=.,comma=%2C'],
205
-                ['{+path:6}',       '/foo/b'],
206
-                ['{+list}',         'red,green,blue'],
207
-                ['{+list*}',        'red,green,blue'],
208
-                ['{+keys}',         'semi,;,dot,.,comma,,'],
209
-                ['{+keys*}',        'semi=;,dot=.,comma=,'],
210
-                ['{#path:6}',       '#/foo/b'],
211
-                ['{#list}',         '#red,green,blue'],
212
-                ['{#list*}',        '#red,green,blue'],
213
-                ['{#keys}',         '#semi,;,dot,.,comma,,'],
214
-                ['{#keys*}',        '#semi=;,dot=.,comma=,'],
215
-                ['{.var:3}',       '.val'],
216
-                ['{.list}',        '.red,green,blue'],
217
-                ['{.list*}',       '.red.green.blue'],
218
-                ['{.keys}',        '.semi,%3B,dot,.,comma,%2C'],
219
-                ['{.keys*}',       '.semi=%3B.dot=..comma=%2C'],
220
-                ['{/var:1,var}',    '/v/value'],
221
-                ['{/list}',         '/red,green,blue'],
222
-                ['{/list*}',        '/red/green/blue'],
199
+                ['{var:3}', 'val'],
200
+                ['{var:30}', 'value'],
201
+                ['{list}', 'red,green,blue'],
202
+                ['{list*}', 'red,green,blue'],
203
+                ['{keys}', 'semi,%3B,dot,.,comma,%2C'],
204
+                ['{keys*}', 'semi=%3B,dot=.,comma=%2C'],
205
+                ['{+path:6}', '/foo/b'],
206
+                ['{+list}', 'red,green,blue'],
207
+                ['{+list*}', 'red,green,blue'],
208
+                ['{+keys}', 'semi,;,dot,.,comma,,'],
209
+                ['{+keys*}', 'semi=;,dot=.,comma=,'],
210
+                ['{#path:6}', '#/foo/b'],
211
+                ['{#list}', '#red,green,blue'],
212
+                ['{#list*}', '#red,green,blue'],
213
+                ['{#keys}', '#semi,;,dot,.,comma,,'],
214
+                ['{#keys*}', '#semi=;,dot=.,comma=,'],
215
+                ['{.var:3}', '.val'],
216
+                ['{.list}', '.red,green,blue'],
217
+                ['{.list*}', '.red.green.blue'],
218
+                ['{.keys}', '.semi,%3B,dot,.,comma,%2C'],
219
+                ['{.keys*}', '.semi=%3B.dot=..comma=%2C'],
220
+                ['{/var:1,var}', '/v/value'],
221
+                ['{/list}', '/red,green,blue'],
222
+                ['{/list*}', '/red/green/blue'],
223 223
                 ['{/list*,path:4}', '/red/green/blue/%2Ffoo'],
224
-                ['{/keys}',             '/semi,%3B,dot,.,comma,%2C'],
225
-                ['{/keys*}',            '/semi=%3B/dot=./comma=%2C'],
226
-                ['{;hello:5}',          ';hello=Hello'],
227
-                ['{;list}',             ';list=red,green,blue'],
228
-                ['{;list*}',            ';list=red;list=green;list=blue'],
229
-                ['{;keys}',             ';keys=semi,%3B,dot,.,comma,%2C'],
230
-                ['{;keys*}',            ';semi=%3B;dot=.;comma=%2C'],
231
-                ['{?var:3}',            '?var=val'],
232
-                ['{?list}',             '?list=red,green,blue'],
233
-                ['{?list*}',            '?list=red&list=green&list=blue'],
234
-                ['{?keys}',             '?keys=semi,%3B,dot,.,comma,%2C'],
235
-                ['{?keys*}',            '?semi=%3B&dot=.&comma=%2C'],
236
-                ['{&var:3}',            '&var=val'],
237
-                ['{&list}',             '&list=red,green,blue'],
238
-                ['{&list*}',            '&list=red&list=green&list=blue'],
239
-                ['{&keys}',             '&keys=semi,%3B,dot,.,comma,%2C'],
240
-                ['{&keys*}',            '&semi=%3B&dot=.&comma=%2C'],
241
-                ['{.null}',            ''],
242
-                ['{.null,var}',        '.value'],
243
-                ['{.empty_keys*}',     ''],
244
-                ['{.empty_keys}',      ''],
224
+                ['{/keys}', '/semi,%3B,dot,.,comma,%2C'],
225
+                ['{/keys*}', '/semi=%3B/dot=./comma=%2C'],
226
+                ['{;hello:5}', ';hello=Hello'],
227
+                ['{;list}', ';list=red,green,blue'],
228
+                ['{;list*}', ';list=red;list=green;list=blue'],
229
+                ['{;keys}', ';keys=semi,%3B,dot,.,comma,%2C'],
230
+                ['{;keys*}', ';semi=%3B;dot=.;comma=%2C'],
231
+                ['{?var:3}', '?var=val'],
232
+                ['{?list}', '?list=red,green,blue'],
233
+                ['{?list*}', '?list=red&list=green&list=blue'],
234
+                ['{?keys}', '?keys=semi,%3B,dot,.,comma,%2C'],
235
+                ['{?keys*}', '?semi=%3B&dot=.&comma=%2C'],
236
+                ['{&var:3}', '&var=val'],
237
+                ['{&list}', '&list=red,green,blue'],
238
+                ['{&list*}', '&list=red&list=green&list=blue'],
239
+                ['{&keys}', '&keys=semi,%3B,dot,.,comma,%2C'],
240
+                ['{&keys*}', '&semi=%3B&dot=.&comma=%2C'],
241
+                ['{.null}', ''],
242
+                ['{.null,var}', '.value'],
243
+                ['{.empty_keys*}', ''],
244
+                ['{.empty_keys}', ''],
245 245
             ],
246 246
             'extra' => [
247 247
                 // Test that missing expansions are skipped
Please login to merge, or discard this patch.
tests/ResolverTest.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -53,44 +53,44 @@
 block discarded – undo
53 53
         $base_uri = 'http://a/b/c/d;p?q';
54 54
 
55 55
         return [
56
-            'base uri'                => [$base_uri, '',              $base_uri],
57
-            'scheme'                  => [$base_uri, 'http://d/e/f',  'http://d/e/f'],
58
-            'path 1'                  => [$base_uri, 'g',             'http://a/b/c/g'],
59
-            'path 2'                  => [$base_uri, './g',           'http://a/b/c/g'],
60
-            'path 3'                  => [$base_uri, 'g/',            'http://a/b/c/g/'],
61
-            'path 4'                  => [$base_uri, '/g',            'http://a/g'],
62
-            'authority'               => [$base_uri, '//g',           'http://g'],
63
-            'query'                   => [$base_uri, '?y',            'http://a/b/c/d;p?y'],
64
-            'path + query'            => [$base_uri, 'g?y',           'http://a/b/c/g?y'],
65
-            'fragment'                => [$base_uri, '#s',            'http://a/b/c/d;p?q#s'],
66
-            'path + fragment'         => [$base_uri, 'g#s',           'http://a/b/c/g#s'],
67
-            'path + query + fragment' => [$base_uri, 'g?y#s',         'http://a/b/c/g?y#s'],
68
-            'single dot 1'            => [$base_uri, '.',             'http://a/b/c/'],
69
-            'single dot 2'            => [$base_uri, './',            'http://a/b/c/'],
70
-            'single dot 3'            => [$base_uri, './g/.',         'http://a/b/c/g/'],
71
-            'single dot 4'            => [$base_uri, 'g/./h',         'http://a/b/c/g/h'],
72
-            'double dot 1'            => [$base_uri, '..',            'http://a/b/'],
73
-            'double dot 2'            => [$base_uri, '../',           'http://a/b/'],
74
-            'double dot 3'            => [$base_uri, '../g',          'http://a/b/g'],
75
-            'double dot 4'            => [$base_uri, '../..',         'http://a/'],
76
-            'double dot 5'            => [$base_uri, '../../',        'http://a/'],
77
-            'double dot 6'            => [$base_uri, '../../g',       'http://a/g'],
78
-            'double dot 7'            => [$base_uri, '../../../g',    'http://a/g'],
56
+            'base uri'                => [$base_uri, '', $base_uri],
57
+            'scheme'                  => [$base_uri, 'http://d/e/f', 'http://d/e/f'],
58
+            'path 1'                  => [$base_uri, 'g', 'http://a/b/c/g'],
59
+            'path 2'                  => [$base_uri, './g', 'http://a/b/c/g'],
60
+            'path 3'                  => [$base_uri, 'g/', 'http://a/b/c/g/'],
61
+            'path 4'                  => [$base_uri, '/g', 'http://a/g'],
62
+            'authority'               => [$base_uri, '//g', 'http://g'],
63
+            'query'                   => [$base_uri, '?y', 'http://a/b/c/d;p?y'],
64
+            'path + query'            => [$base_uri, 'g?y', 'http://a/b/c/g?y'],
65
+            'fragment'                => [$base_uri, '#s', 'http://a/b/c/d;p?q#s'],
66
+            'path + fragment'         => [$base_uri, 'g#s', 'http://a/b/c/g#s'],
67
+            'path + query + fragment' => [$base_uri, 'g?y#s', 'http://a/b/c/g?y#s'],
68
+            'single dot 1'            => [$base_uri, '.', 'http://a/b/c/'],
69
+            'single dot 2'            => [$base_uri, './', 'http://a/b/c/'],
70
+            'single dot 3'            => [$base_uri, './g/.', 'http://a/b/c/g/'],
71
+            'single dot 4'            => [$base_uri, 'g/./h', 'http://a/b/c/g/h'],
72
+            'double dot 1'            => [$base_uri, '..', 'http://a/b/'],
73
+            'double dot 2'            => [$base_uri, '../', 'http://a/b/'],
74
+            'double dot 3'            => [$base_uri, '../g', 'http://a/b/g'],
75
+            'double dot 4'            => [$base_uri, '../..', 'http://a/'],
76
+            'double dot 5'            => [$base_uri, '../../', 'http://a/'],
77
+            'double dot 6'            => [$base_uri, '../../g', 'http://a/g'],
78
+            'double dot 7'            => [$base_uri, '../../../g', 'http://a/g'],
79 79
             'double dot 8'            => [$base_uri, '../../../../g', 'http://a/g'],
80
-            'double dot 9'            => [$base_uri, 'g/../h' ,       'http://a/b/c/h'],
81
-            'mulitple slashes'        => [$base_uri, 'foo////g',      'http://a/b/c/foo////g'],
82
-            'complex path 1'          => [$base_uri, ';x',            'http://a/b/c/;x'],
83
-            'complex path 2'          => [$base_uri, 'g;x',           'http://a/b/c/g;x'],
84
-            'complex path 3'          => [$base_uri, 'g;x?y#s',       'http://a/b/c/g;x?y#s'],
85
-            'complex path 4'          => [$base_uri, 'g;x=1/./y',     'http://a/b/c/g;x=1/y'],
86
-            'complex path 5'          => [$base_uri, 'g;x=1/../y',    'http://a/b/c/y'],
87
-            'dot segments presence 1' => [$base_uri, '/./g',          'http://a/g'],
88
-            'dot segments presence 2' => [$base_uri, '/../g',         'http://a/g'],
89
-            'dot segments presence 3' => [$base_uri, 'g.',            'http://a/b/c/g.'],
90
-            'dot segments presence 4' => [$base_uri, '.g',            'http://a/b/c/.g'],
91
-            'dot segments presence 5' => [$base_uri, 'g..',           'http://a/b/c/g..'],
92
-            'dot segments presence 6' => [$base_uri, '..g',           'http://a/b/c/..g'],
93
-            'origin uri without path' => ['http://h:b@a', 'b/../y',   'http://h:b@a/y'],
80
+            'double dot 9'            => [$base_uri, 'g/../h', 'http://a/b/c/h'],
81
+            'mulitple slashes'        => [$base_uri, 'foo////g', 'http://a/b/c/foo////g'],
82
+            'complex path 1'          => [$base_uri, ';x', 'http://a/b/c/;x'],
83
+            'complex path 2'          => [$base_uri, 'g;x', 'http://a/b/c/g;x'],
84
+            'complex path 3'          => [$base_uri, 'g;x?y#s', 'http://a/b/c/g;x?y#s'],
85
+            'complex path 4'          => [$base_uri, 'g;x=1/./y', 'http://a/b/c/g;x=1/y'],
86
+            'complex path 5'          => [$base_uri, 'g;x=1/../y', 'http://a/b/c/y'],
87
+            'dot segments presence 1' => [$base_uri, '/./g', 'http://a/g'],
88
+            'dot segments presence 2' => [$base_uri, '/../g', 'http://a/g'],
89
+            'dot segments presence 3' => [$base_uri, 'g.', 'http://a/b/c/g.'],
90
+            'dot segments presence 4' => [$base_uri, '.g', 'http://a/b/c/.g'],
91
+            'dot segments presence 5' => [$base_uri, 'g..', 'http://a/b/c/g..'],
92
+            'dot segments presence 6' => [$base_uri, '..g', 'http://a/b/c/..g'],
93
+            'origin uri without path' => ['http://h:b@a', 'b/../y', 'http://h:b@a/y'],
94 94
         ];
95 95
     }
96 96
 }
Please login to merge, or discard this patch.
tests/RelativizerTest.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function testRelativize(string $uri, string $resolved, string $expected): void
40 40
     {
41
-        $uri   = Http::createFromString($uri);
41
+        $uri = Http::createFromString($uri);
42 42
         $resolved = Uri::createFromString($resolved);
43 43
         self::assertSame($expected, (string) UriResolver::relativize($resolved, $uri));
44 44
     }
@@ -46,43 +46,43 @@  discard block
 block discarded – undo
46 46
     public function relativizeProvider(): array
47 47
     {
48 48
         return [
49
-            'different scheme'        => [self::BASE_URI,       'https://a/b/c/d;p?q',   'https://a/b/c/d;p?q'],
50
-            'different authority'     => [self::BASE_URI,       'https://g/b/c/d;p?q',   'https://g/b/c/d;p?q'],
51
-            'empty uri'               => [self::BASE_URI,       '',                      ''],
52
-            'same uri'                => [self::BASE_URI,       self::BASE_URI,          ''],
53
-            'same path'               => [self::BASE_URI,       'http://a/b/c/d;p',      'd;p'],
54
-            'parent path 1'           => [self::BASE_URI,       'http://a/b/c/',         './'],
55
-            'parent path 2'           => [self::BASE_URI,       'http://a/b/',           '../'],
56
-            'parent path 3'           => [self::BASE_URI,       'http://a/',             '../../'],
57
-            'parent path 4'           => [self::BASE_URI,       'http://a',              '../../'],
58
-            'sibling path 1'          => [self::BASE_URI,       'http://a/b/c/g',        'g'],
59
-            'sibling path 2'          => [self::BASE_URI,       'http://a/b/c/g/h',      'g/h'],
60
-            'sibling path 3'          => [self::BASE_URI,       'http://a/b/g',          '../g'],
61
-            'sibling path 4'          => [self::BASE_URI,       'http://a/g',            '../../g'],
62
-            'query'                   => [self::BASE_URI,       'http://a/b/c/d;p?y',    '?y'],
63
-            'fragment'                => [self::BASE_URI,       'http://a/b/c/d;p?q#s',  '#s'],
64
-            'path + query'            => [self::BASE_URI,       'http://a/b/c/g?y',      'g?y'],
65
-            'path + fragment'         => [self::BASE_URI,       'http://a/b/c/g#s',      'g#s'],
66
-            'path + query + fragment' => [self::BASE_URI,       'http://a/b/c/g?y#s',    'g?y#s'],
67
-            'empty segments'          => [self::BASE_URI,       'http://a/b/c/foo////g', 'foo////g'],
68
-            'empty segments 1'        => [self::BASE_URI,       'http://a/b////c/foo/g', '..////c/foo/g'],
69
-            'relative single dot 1'   => [self::BASE_URI,       '.',                     '.'],
70
-            'relative single dot 2'   => [self::BASE_URI,       './',                    './'],
71
-            'relative double dot 1'   => [self::BASE_URI,       '..',                    '..'],
72
-            'relative double dot 2'   => [self::BASE_URI,       '../',                   '../'],
73
-            'path with colon 1'       => ['http://a/',          'http://a/d:p',          './d:p'],
74
-            'path with colon 2'       => [self::BASE_URI,       'http://a/b/c/g/d:p',    'g/d:p'],
75
-            'scheme + auth 1'         => ['http://a',           'http://a?q#s',          '?q#s'],
76
-            'scheme + auth 2'         => ['http://a/',          'http://a?q#s',          '/?q#s'],
77
-            '2 relative paths 1'      => ['a/b',                '../..',                 '../..'],
78
-            '2 relative paths 2'      => ['a/b',                './.',                   './.'],
79
-            '2 relative paths 3'      => ['a/b',                '../c',                  '../c'],
80
-            '2 relative paths 4'      => ['a/b',                'c/..',                  'c/..'],
81
-            '2 relative paths 5'      => ['a/b',                'c/.',                   'c/.'],
82
-            'baseUri with query'      => ['/a/b/?q',            '/a/b/#h',               './#h'],
83
-            'targetUri with fragment' => ['/',                  '/#h',                   '#h'],
84
-            'same document'           => ['/',                  '/',                     ''],
85
-            'same URI normalized'     => ['http://a',           'http://a/',             ''],
49
+            'different scheme'        => [self::BASE_URI, 'https://a/b/c/d;p?q', 'https://a/b/c/d;p?q'],
50
+            'different authority'     => [self::BASE_URI, 'https://g/b/c/d;p?q', 'https://g/b/c/d;p?q'],
51
+            'empty uri'               => [self::BASE_URI, '', ''],
52
+            'same uri'                => [self::BASE_URI, self::BASE_URI, ''],
53
+            'same path'               => [self::BASE_URI, 'http://a/b/c/d;p', 'd;p'],
54
+            'parent path 1'           => [self::BASE_URI, 'http://a/b/c/', './'],
55
+            'parent path 2'           => [self::BASE_URI, 'http://a/b/', '../'],
56
+            'parent path 3'           => [self::BASE_URI, 'http://a/', '../../'],
57
+            'parent path 4'           => [self::BASE_URI, 'http://a', '../../'],
58
+            'sibling path 1'          => [self::BASE_URI, 'http://a/b/c/g', 'g'],
59
+            'sibling path 2'          => [self::BASE_URI, 'http://a/b/c/g/h', 'g/h'],
60
+            'sibling path 3'          => [self::BASE_URI, 'http://a/b/g', '../g'],
61
+            'sibling path 4'          => [self::BASE_URI, 'http://a/g', '../../g'],
62
+            'query'                   => [self::BASE_URI, 'http://a/b/c/d;p?y', '?y'],
63
+            'fragment'                => [self::BASE_URI, 'http://a/b/c/d;p?q#s', '#s'],
64
+            'path + query'            => [self::BASE_URI, 'http://a/b/c/g?y', 'g?y'],
65
+            'path + fragment'         => [self::BASE_URI, 'http://a/b/c/g#s', 'g#s'],
66
+            'path + query + fragment' => [self::BASE_URI, 'http://a/b/c/g?y#s', 'g?y#s'],
67
+            'empty segments'          => [self::BASE_URI, 'http://a/b/c/foo////g', 'foo////g'],
68
+            'empty segments 1'        => [self::BASE_URI, 'http://a/b////c/foo/g', '..////c/foo/g'],
69
+            'relative single dot 1'   => [self::BASE_URI, '.', '.'],
70
+            'relative single dot 2'   => [self::BASE_URI, './', './'],
71
+            'relative double dot 1'   => [self::BASE_URI, '..', '..'],
72
+            'relative double dot 2'   => [self::BASE_URI, '../', '../'],
73
+            'path with colon 1'       => ['http://a/', 'http://a/d:p', './d:p'],
74
+            'path with colon 2'       => [self::BASE_URI, 'http://a/b/c/g/d:p', 'g/d:p'],
75
+            'scheme + auth 1'         => ['http://a', 'http://a?q#s', '?q#s'],
76
+            'scheme + auth 2'         => ['http://a/', 'http://a?q#s', '/?q#s'],
77
+            '2 relative paths 1'      => ['a/b', '../..', '../..'],
78
+            '2 relative paths 2'      => ['a/b', './.', './.'],
79
+            '2 relative paths 3'      => ['a/b', '../c', '../c'],
80
+            '2 relative paths 4'      => ['a/b', 'c/..', 'c/..'],
81
+            '2 relative paths 5'      => ['a/b', 'c/.', 'c/.'],
82
+            'baseUri with query'      => ['/a/b/?q', '/a/b/#h', './#h'],
83
+            'targetUri with fragment' => ['/', '/#h', '#h'],
84
+            'same document'           => ['/', '/', ''],
85
+            'same URI normalized'     => ['http://a', 'http://a/', ''],
86 86
         ];
87 87
     }
88 88
 
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
     public function relativizeAndResolveProvider(): array
112 112
     {
113 113
         return [
114
-            'empty path'            => [self::BASE_URI, 'http://a/', '../../',   'http://a/'],
115
-            'absolute empty path'   => [self::BASE_URI, 'http://a',  '../../',   'http://a/'],
116
-            'relative single dot 1' => [self::BASE_URI, '.',         '.',        'http://a/b/c/'],
117
-            'relative single dot 2' => [self::BASE_URI, './',        './',       'http://a/b/c/'],
118
-            'relative double dot 1' => [self::BASE_URI, '..',        '..',       'http://a/b/'],
119
-            'relative double dot 2' => [self::BASE_URI, '../',       '../',      'http://a/b/'],
120
-            '2 relative paths 1'    => ['a/b',          '../..',     '../..',    '/'],
121
-            '2 relative paths 2'    => ['a/b',          './.',       './.',      'a/'],
122
-            '2 relative paths 3'    => ['a/b',          '../c',      '../c',     'c'],
123
-            '2 relative paths 4'    => ['a/b',          'c/..',      'c/..',     'a/'],
124
-            '2 relative paths 5'    => ['a/b',          'c/.',       'c/.',      'a/c/'],
125
-            'path with colon'       => ['http://a/',    'http://a/d:p', './d:p', 'http://a/d:p'],
114
+            'empty path'            => [self::BASE_URI, 'http://a/', '../../', 'http://a/'],
115
+            'absolute empty path'   => [self::BASE_URI, 'http://a', '../../', 'http://a/'],
116
+            'relative single dot 1' => [self::BASE_URI, '.', '.', 'http://a/b/c/'],
117
+            'relative single dot 2' => [self::BASE_URI, './', './', 'http://a/b/c/'],
118
+            'relative double dot 1' => [self::BASE_URI, '..', '..', 'http://a/b/'],
119
+            'relative double dot 2' => [self::BASE_URI, '../', '../', 'http://a/b/'],
120
+            '2 relative paths 1'    => ['a/b', '../..', '../..', '/'],
121
+            '2 relative paths 2'    => ['a/b', './.', './.', 'a/'],
122
+            '2 relative paths 3'    => ['a/b', '../c', '../c', 'c'],
123
+            '2 relative paths 4'    => ['a/b', 'c/..', 'c/..', 'a/'],
124
+            '2 relative paths 5'    => ['a/b', 'c/.', 'c/.', 'a/c/'],
125
+            'path with colon'       => ['http://a/', 'http://a/d:p', './d:p', 'http://a/d:p'],
126 126
         ];
127 127
     }
128 128
 }
Please login to merge, or discard this patch.