@@ -68,7 +68,7 @@ class SiteURI extends URI
68
68
* 0 => 'test',
69
69
* ];
70
70
*
71
- * @var array
71
+ * @var array<int, string>
72
72
*
73
73
* @deprecated This property will be private.
74
74
*/
@@ -331,35 +331,48 @@ public function refreshPath()
331
331
332
332
/**
333
333
* Saves our parts from a parse_url() call.
334
+ *
335
+ * @param array{
336
+ * host?: string,
337
+ * user?: string,
338
+ * path?: string,
339
+ * query?: string,
340
+ * fragment?: string,
341
+ * scheme?: string,
342
+ * port?: int,
343
+ * pass?: string,
344
+ * } $parts
334
345
*/
335
346
protected function applyParts (array $ parts ): void
336
347
{
337
- if (! empty ($ parts ['host ' ])) {
348
+ if (isset ($ parts ['host ' ]) && $ parts [ ' host ' ] !== '' ) {
338
349
$ this ->host = $ parts ['host ' ];
339
350
}
340
- if (! empty ($ parts ['user ' ])) {
351
+
352
+ if (isset ($ parts ['user ' ]) && $ parts ['user ' ] !== '' ) {
341
353
$ this ->user = $ parts ['user ' ];
342
354
}
355
+
343
356
if (isset ($ parts ['path ' ]) && $ parts ['path ' ] !== '' ) {
344
357
$ this ->path = $ this ->filterPath ($ parts ['path ' ]);
345
358
}
346
- if (! empty ($ parts ['query ' ])) {
359
+
360
+ if (isset ($ parts ['query ' ]) && $ parts ['query ' ] !== '' ) {
347
361
$ this ->setQuery ($ parts ['query ' ]);
348
362
}
349
- if (! empty ($ parts ['fragment ' ])) {
363
+
364
+ if (isset ($ parts ['fragment ' ]) && $ parts ['fragment ' ] !== '' ) {
350
365
$ this ->fragment = $ parts ['fragment ' ];
351
366
}
352
367
353
- // Scheme
354
368
if (isset ($ parts ['scheme ' ])) {
355
369
$ this ->setScheme (rtrim ($ parts ['scheme ' ], ':/ ' ));
356
370
} else {
357
371
$ this ->setScheme ('http ' );
358
372
}
359
373
360
- // Port
361
- if (isset ($ parts ['port ' ]) && $ parts ['port ' ] !== null ) {
362
- // Valid port numbers are enforced by earlier parse_url() or setPort()
374
+ if (isset ($ parts ['port ' ])) {
375
+ // Valid port numbers are enforced by earlier parse_url or setPort()
363
376
$ this ->port = $ parts ['port ' ];
364
377
}
365
378
0 commit comments