Skip to content

Commit 7c3dd47

Browse files
committed
Improve Interfaces documentation
1 parent 4a617cc commit 7c3dd47

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ All Notable changes to `League\Uri\Interfaces` will be documented in this file
2424
- `UriString::containsValidRfc3987Characters`
2525
- `UriString::isValidScheme`
2626
- `UriString::isValidHost`
27-
- `UriString::buildUserInfo`
2827
- `FeatureDetection::supportsDom`
2928
- `Encoder::decodeNecessary`
3029
- `Encoder::decodePath`
@@ -47,7 +46,7 @@ All Notable changes to `League\Uri\Interfaces` will be documented in this file
4746
### Fixed
4847

4948
- `UriString::parse` will fail if the URI contains whitespace.
50-
- `UriString::buildUri` allows the `$path` argument to be `null`.
49+
- `UriString::buildUri` allows all arguments to be `null` including the `path`.
5150
- `UriString::buildAuthority` allows the `$user` argument to be `null` and still generate a user info component.
5251

5352
### Deprecated

Encoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public static function decodeQuery(Stringable|string|null $path): ?string
287287
}
288288

289289
/**
290-
* Normalize query component.
290+
* Normalize the query component.
291291
*
292292
* The value returned MUST be percent-encoded, but MUST NOT double-encode
293293
* any characters. To determine what characters to encode, please refer to
@@ -317,7 +317,7 @@ public static function decodeFragment(Stringable|string|null $path): ?string
317317
}
318318

319319
/**
320-
* Normalize fragment component.
320+
* Normalize the fragment component.
321321
*
322322
* The value returned MUST be percent-encoded, but MUST NOT double-encode
323323
* any characters. To determine what characters to encode, please refer to
@@ -329,7 +329,7 @@ public static function normalizeFragment(Stringable|string|null $fragment): ?str
329329
}
330330

331331
/**
332-
* Normalize host component.
332+
* Normalize the host component.
333333
*
334334
* @see https://www.rfc-editor.org/rfc/rfc3986.html#section-3.2.2
335335
*

UriString.php

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -218,20 +218,20 @@ public static function build(array $components): string
218218
}
219219

220220
/**
221-
* Generate a URI string representation based on RFC3986 algorithm.
221+
* Generates a URI string representation based on RFC3986 algorithm.
222222
*
223-
* valid URI component MUST be provided without their URI delimiters
223+
* Valid URI component MUST be provided without their URI delimiters
224224
* but properly encoded.
225225
*
226226
* @link https://tools.ietf.org/html/rfc3986#section-5.3
227227
* @link https://tools.ietf.org/html/rfc3986#section-7.5§
228228
*/
229229
public static function buildUri(
230-
?string $scheme,
231-
?string $authority,
232-
?string $path,
233-
?string $query,
234-
?string $fragment,
230+
?string $scheme = null,
231+
?string $authority = null,
232+
?string $path = null,
233+
?string $query = null,
234+
?string $fragment = null,
235235
): string {
236236
self::validateComponents($scheme, $authority, $path);
237237
$uri = '';
@@ -284,25 +284,6 @@ public static function buildAuthority(array $components): ?string
284284
return $authority;
285285
}
286286

287-
/**
288-
* Generate a URI UserInfo representation from the URI parsed representation.
289-
*
290-
* @param InputComponentMap $components
291-
*/
292-
public static function buildUserInfo(array $components): ?string
293-
{
294-
if (!isset($components['user'])) {
295-
return null;
296-
}
297-
298-
$userInfo = $components['user'];
299-
if (! isset($components['pass'])) {
300-
return $userInfo;
301-
}
302-
303-
return $userInfo.':'.$components['pass'];
304-
}
305-
306287
/**
307288
* Parses and normalizes the URI following RFC3986 destructive and non-destructive constraints.
308289
*

0 commit comments

Comments
 (0)