Skip to content

Commit

Permalink
Uri::getUsername is an alias for Uri::getUser
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Jan 5, 2025
1 parent 53f8e6f commit f537e28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
30 changes: 14 additions & 16 deletions Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}

0 comments on commit f537e28

Please sign in to comment.