From f0e42ea97fcda3e8e61a0b77603acc53ef037ac3 Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Sun, 5 Jan 2025 21:08:43 +0100 Subject: [PATCH] Uri::getUsername is an alias for Uri::getUser --- interfaces/Idna/Converter.php | 3 ++- uri/CHANGELOG.md | 1 + uri/Uri.php | 30 ++++++++++++++---------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/interfaces/Idna/Converter.php b/interfaces/Idna/Converter.php index 6bd62a30..faba8ee1 100644 --- a/interfaces/Idna/Converter.php +++ b/interfaces/Idna/Converter.php @@ -21,6 +21,7 @@ use function idn_to_ascii; use function idn_to_utf8; use function rawurldecode; +use function strtolower; use const INTL_IDNA_VARIANT_UTS46; @@ -155,7 +156,7 @@ public static function toUnicode(Stringable|string $domain, Option|int|null $opt idn_to_utf8($domain, $flags->toBytes(), INTL_IDNA_VARIANT_UTS46, $idnaInfo); if ([] === $idnaInfo) { - return Result::fromIntl(['result' => $domain, 'isTransitionalDifferent' => false, 'errors' => Error::NONE->value]); + return Result::fromIntl(['result' => strtolower($domain), 'isTransitionalDifferent' => false, 'errors' => Error::NONE->value]); } return Result::fromIntl($idnaInfo); diff --git a/uri/CHANGELOG.md b/uri/CHANGELOG.md index 73c51f1e..db2d37ef 100644 --- a/uri/CHANGELOG.md +++ b/uri/CHANGELOG.md @@ -13,6 +13,7 @@ All Notable changes to `League\Uri` will be documented in this file - `Uri::when` conditional method to ease component building logic. - `Uri` implements the new `League\Uri\Contract\UriInspector` interface - `Uri` implements the new `League\Uri\Contract\UriRenderer` interface +- `Uri::getUser` returns the encoded user component of the URI an alias for `Uri::getUsername` ### Fixed diff --git a/uri/Uri.php b/uri/Uri.php index a6a85926..b0e34fad 100644 --- a/uri/Uri.php +++ b/uri/Uri.php @@ -1322,13 +1322,26 @@ public function getAuthority(): ?string } /** - * * @see https://wiki.php.net/rfc/url_parsing_api + * Returns the user component encoded value. + * + * @see https://wiki.php.net/rfc/url_parsing_api */ public function getUser(): ?string { return $this->user; } + /** + * Returns the user component encoded value. + * + * @codeCoverageIgnore + * @see Uri::getUser() + */ + public function getUsername(): ?string + { + return $this->getUser(); + } + public function getPassword(): ?string { return $this->pass; @@ -1964,19 +1977,4 @@ public static function createFromServer(array $server): self { return self::fromServer($server); } - - /** - * DEPRECATION WARNING! This method will be removed in the next major point release. - * - * @deprecated Since version 7.6.0 - * @codeCoverageIgnore - * @see Uri::getUser() - * - * Retuns the user component encoded value. - */ - #[Deprecated(message:'use League\Uri\Uri::getUser() instead', since:'league/uri:7.6.0')] - public function getUsername(): ?string - { - return $this->getUser(); - } }