1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

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

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 @@ protected function getUser($username)
/**
* 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);