Skip to content

Commit ebb8381

Browse files
committed
Prepare release
1 parent 53b90d0 commit ebb8381

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

phpunit.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</report>
1818
</coverage>
1919
<testsuites>
20-
<testsuite name="URI Test Suite">
20+
<testsuite name="PHP URI ToolKit Test Suite">
2121
<directory suffix="Test.php">uri</directory>
2222
<directory suffix="Test.php">components</directory>
2323
<directory suffix="Test.php">interfaces</directory>
@@ -37,7 +37,6 @@
3737
<exclude>
3838
<directory suffix="Bench.php">uri</directory>
3939
<directory suffix="Test.php">uri</directory>
40-
<directory suffix="TestCase.php">uri</directory>
4140
<directory suffix="Bench.php">components</directory>
4241
<directory suffix="Test.php">components</directory>
4342
<directory suffix="Bench.php">interfaces</directory>

uri/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ All Notable changes to `League\Uri` will be documented in this file
3030
- `Uri::withUsername` returns a new `Uri` instance with the updated username component.
3131
- `Uri::withPassword` returns a new `Uri` instance with the updated password component.
3232
- `Uri::toAsciiString` returns the URI string representation as per RFC3986
33-
- `Uri::toAsciiString` returns the URI string representation as per RFC3987 with the host in unicode form if available
34-
- `Uri::getUnicodeHost` returns the host in Unicode form if available; fallback to its RFC39 86 representation otherwise
33+
- `Uri::toAsciiString` returns the URI string representation as per RFC3987 with the host in Unicode form if available
34+
- `Uri::getUnicodeHost` returns the host in Unicode form if available; fallback to its RFC3986 representation otherwise
3535
- `UriTemplate` implements the `Stringable` interface
3636
- `UriTemplate::expandToUri` and `UriTemplate::expandToUriOrFail`
3737
- `UriTemplate::expandToUrl` and `UriTemplate::expandToUrlOrFail`

uri/Uri.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,34 @@ private static function formatFilePath(string $path): string
888888
);
889889
}
890890

891+
/**
892+
* assert the URI internal state is valid.
893+
*
894+
* @link https://tools.ietf.org/html/rfc3986#section-3
895+
* @link https://tools.ietf.org/html/rfc3986#section-3.3
896+
*
897+
* @throws SyntaxError if the URI is in an invalid state, according to RFC3986
898+
*/
899+
private function assertValidRfc3986Uri(): void
900+
{
901+
if (null !== $this->authority && ('' !== $this->path && '/' !== $this->path[0])) {
902+
throw new SyntaxError('If an authority is present the path must be empty or start with a `/`.');
903+
}
904+
905+
if (null === $this->authority && str_starts_with($this->path, '//')) {
906+
throw new SyntaxError('If there is no authority the path `' . $this->path . '` cannot start with a `//`.');
907+
}
908+
909+
$pos = strpos($this->path, ':');
910+
if (null === $this->authority
911+
&& null === $this->scheme
912+
&& false !== $pos
913+
&& !str_contains(substr($this->path, 0, $pos), '/')
914+
) {
915+
throw new SyntaxError('In absence of a scheme and an authority the first path segment cannot contain a colon (":") character.');
916+
}
917+
}
918+
891919
/**
892920
* assert the URI scheme is valid
893921
*
@@ -946,34 +974,6 @@ private function assertValidState(): void
946974
} || throw new SyntaxError('The uri `'.$this->uriAsciiString.'` is invalid for the `'.$this->scheme.'` scheme.');
947975
}
948976

949-
/**
950-
* assert the URI internal state is valid.
951-
*
952-
* @link https://tools.ietf.org/html/rfc3986#section-3
953-
* @link https://tools.ietf.org/html/rfc3986#section-3.3
954-
*
955-
* @throws SyntaxError if the URI is in an invalid state, according to RFC3986
956-
*/
957-
private function assertValidRfc3986Uri(): void
958-
{
959-
if (null !== $this->authority && ('' !== $this->path && '/' !== $this->path[0])) {
960-
throw new SyntaxError('If an authority is present the path must be empty or start with a `/`.');
961-
}
962-
963-
if (null === $this->authority && str_starts_with($this->path, '//')) {
964-
throw new SyntaxError('If there is no authority the path `' . $this->path . '` cannot start with a `//`.');
965-
}
966-
967-
$pos = strpos($this->path, ':');
968-
if (null === $this->authority
969-
&& null === $this->scheme
970-
&& false !== $pos
971-
&& !str_contains(substr($this->path, 0, $pos), '/')
972-
) {
973-
throw new SyntaxError('In absence of a scheme and an authority the first path segment cannot contain a colon (":") character.');
974-
}
975-
}
976-
977977
private function isValidBlob(): bool
978978
{
979979
static $regexpUuidRfc4122 = '/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i';

0 commit comments

Comments
 (0)