Add proper types to TNeedsUser

This commit is contained in:
Tim Düsterhus 2022-03-04 20:11:15 +01:00
parent c5485440bf
commit b8a76b412f
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF
1 changed files with 2 additions and 8 deletions

View File

@ -26,11 +26,8 @@ trait TNeedsUser
{
/**
* Returns the user with the given username.
*
* @param string $username
* @return \wcf\data\user\User
*/
protected function getUser($username)
protected function getUser(string $username): User
{
static $cache = [ ];
if (!isset($cache[$username])) {
@ -42,11 +39,8 @@ trait TNeedsUser
/**
* Checks whether the given username is valid and throws otherwise.
*
* @param string $username
* @return \wcf\data\user\User
*/
protected function assertUser($username)
protected function assertUser(string $username): User
{
$user = $this->getUser($username);