diff --git a/lib/private/User/LazyUser.php b/lib/private/User/LazyUser.php index 3ae6a557a2d..25ea950bf85 100644 --- a/lib/private/User/LazyUser.php +++ b/lib/private/User/LazyUser.php @@ -1,6 +1,7 @@ displayName) { return $this->displayName; } @@ -56,7 +58,7 @@ class LazyUser implements IUser { } #[\Override] - public function setDisplayName($displayName) { + public function setDisplayName($displayName): bool { return $this->getUser()->setDisplayName($displayName); } @@ -76,12 +78,12 @@ class LazyUser implements IUser { } #[\Override] - public function delete() { + public function delete(): bool { return $this->getUser()->delete(); } #[\Override] - public function setPassword($password, $recoveryPassword = null) { + public function setPassword($password, $recoveryPassword = null): bool { return $this->getUser()->setPassword($password, $recoveryPassword); } @@ -96,12 +98,12 @@ class LazyUser implements IUser { } #[\Override] - public function getHome() { + public function getHome(): string { return $this->getUser()->getHome(); } #[\Override] - public function getBackendClassName() { + public function getBackendClassName(): string { return $this->getUser()->getBackendClassName(); } @@ -136,17 +138,17 @@ class LazyUser implements IUser { } #[\Override] - public function isEnabled() { + public function isEnabled(): bool { return $this->getUser()->isEnabled(); } #[\Override] - public function setEnabled(bool $enabled = true) { - return $this->getUser()->setEnabled($enabled); + public function setEnabled(bool $enabled = true): void { + $this->getUser()->setEnabled($enabled); } #[\Override] - public function getEMailAddress() { + public function getEMailAddress(): string { return $this->getUser()->getEMailAddress(); } @@ -161,17 +163,17 @@ class LazyUser implements IUser { } #[\Override] - public function getAvatarImage($size) { + public function getAvatarImage($size): ?IImage { return $this->getUser()->getAvatarImage($size); } #[\Override] - public function getCloudId() { + public function getCloudId(): string { return $this->getUser()->getCloudId(); } #[\Override] - public function setEMailAddress($mailAddress) { + public function setEMailAddress($mailAddress): void { $this->getUser()->setEMailAddress($mailAddress); } @@ -186,7 +188,7 @@ class LazyUser implements IUser { } #[\Override] - public function getQuota() { + public function getQuota(): string { return $this->getUser()->getQuota(); } @@ -196,7 +198,7 @@ class LazyUser implements IUser { } #[\Override] - public function setQuota($quota) { + public function setQuota($quota): void { $this->getUser()->setQuota($quota); } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index d22b8ae89a4..e54ac397b3e 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -481,11 +481,9 @@ class User implements IUser { /** * set the enabled status for the user - * - * @return void */ #[\Override] - public function setEnabled(bool $enabled = true) { + public function setEnabled(bool $enabled = true): void { $oldStatus = $this->isEnabled(); $setDatabaseValue = function (bool $enabled): void { $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false'); @@ -524,18 +522,12 @@ class User implements IUser { return $this->getPrimaryEMailAddress() ?? $this->getSystemEMailAddress(); } - /** - * @inheritDoc - */ #[\Override] public function getSystemEMailAddress(): ?string { $email = $this->config->getUserValue($this->uid, 'settings', 'email', null); return $email ? mb_strtolower(trim($email)) : null; } - /** - * @inheritDoc - */ #[\Override] public function getPrimaryEMailAddress(): ?string { $email = $this->config->getUserValue($this->uid, 'settings', 'primary_email', null); diff --git a/lib/public/IUser.php b/lib/public/IUser.php index 5a06577fde7..afbcfd2df08 100644 --- a/lib/public/IUser.php +++ b/lib/public/IUser.php @@ -27,36 +27,31 @@ interface IUser { /** * get the user id * - * @return string * @since 8.0.0 */ - public function getUID(); + public function getUID(): string; /** * get the display name for the user, if no specific display name is set it will fallback to the user id * - * @return string * @since 8.0.0 */ - public function getDisplayName(); + public function getDisplayName(): string; /** * set the display name for the user * - * @param string $displayName - * @return bool * @since 8.0.0 * * @since 25.0.0 Throw InvalidArgumentException * @throws \InvalidArgumentException */ - public function setDisplayName($displayName); + public function setDisplayName(string $displayName): bool; /** * returns the timestamp of the user's last login or 0 if the user did never * login * - * @return int * @since 8.0.0 */ public function getLastLogin(): int; @@ -79,20 +74,18 @@ interface IUser { /** * Delete the user * - * @return bool * @since 8.0.0 */ - public function delete(); + public function delete(): bool; /** * Set the password of the user * * @param string $password * @param string $recoveryPassword for the encryption app to reset encryption keys - * @return bool * @since 8.0.0 */ - public function setPassword($password, $recoveryPassword = null); + public function setPassword($password, $recoveryPassword = null): bool; /** * Get the password hash of the user @@ -114,25 +107,23 @@ interface IUser { /** * get the users home folder to mount * - * @return string * @since 8.0.0 */ - public function getHome(); + public function getHome(): string; /** * Get the name of the backend class the user is connected with * - * @return string * @since 8.0.0 */ - public function getBackendClassName(); + public function getBackendClassName(): string; /** * Get the backend for the current user object - * @return ?UserInterface + * * @since 15.0.0 */ - public function getBackend(); + public function getBackend(): ?UserInterface; /** * check if the backend allows the user to change their avatar on Personal page @@ -171,26 +162,23 @@ interface IUser { /** * check if the user is enabled * - * @return bool * @since 8.0.0 */ - public function isEnabled(); + public function isEnabled(): bool; /** * set the enabled status for the user * - * @param bool $enabled * @since 8.0.0 */ - public function setEnabled(bool $enabled = true); + public function setEnabled(bool $enabled = true): void; /** * get the user's email address * - * @return string|null * @since 9.0.0 */ - public function getEMailAddress(); + public function getEMailAddress(): ?string; /** * get the user's system email address @@ -201,7 +189,6 @@ interface IUser { * Use this getter only when the system address is needed. For picking the * proper address to e.g. send a mail to, use getEMailAddress(). * - * @return string|null * @since 23.0.0 */ public function getSystemEMailAddress(): ?string; @@ -216,7 +203,6 @@ interface IUser { * Use this getter only when the primary address is needed. For picking the * proper address to e.g. send a mail to, use getEMailAddress(). * - * @return string|null * @since 23.0.0 */ public function getPrimaryEMailAddress(): ?string; @@ -225,10 +211,9 @@ interface IUser { * get the avatar image if it exists * * @param int $size - * @return IImage|null * @since 9.0.0 */ - public function getAvatarImage($size); + public function getAvatarImage($size): ?IImage; /** * get the federation cloud id @@ -244,11 +229,10 @@ interface IUser { * It is an alias to setSystemEMailAddress() * * @param string|null $mailAddress - * @return void * @since 9.0.0 * @deprecated 23.0.0 use setSystemEMailAddress() or setPrimaryEMailAddress() */ - public function setEMailAddress($mailAddress); + public function setEMailAddress($mailAddress): void; /** * Set the system email address of the user @@ -282,10 +266,9 @@ interface IUser { * set for the user, the default value is returned. If a default setting * was not set otherwise, it is return as 'none', i.e. quota is not limited. * - * @return string * @since 9.0.0 */ - public function getQuota(); + public function getQuota(): string; /** * Get the users' quota in machine readable form. If a specific quota is set @@ -300,10 +283,9 @@ interface IUser { * set the users' quota * * @param string $quota - * @return void * @since 9.0.0 */ - public function setQuota($quota); + public function setQuota($quota): void; /** * Get the user's manager UIDs