diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-13 20:34:39 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-01-14 21:32:54 +0100 |
commit | 4c56acffd1a4e8760828408a200b0cb2cb154f95 (patch) | |
tree | 09845dee6d236e1a0240af6cdd9a0c1960f25fad /lib | |
parent | c0c42635465cc2731912f44d3f64eb64edfe77bb (diff) | |
download | nextcloud-server-4c56acffd1a4e8760828408a200b0cb2cb154f95.tar.gz nextcloud-server-4c56acffd1a4e8760828408a200b0cb2cb154f95.zip |
Made AvatarManager string and add return types
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AvatarManager.php | 6 | ||||
-rw-r--r-- | lib/public/IAvatarManager.php | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/private/AvatarManager.php b/lib/private/AvatarManager.php index b8c6c2a1eb6..dea7f5f3a07 100644 --- a/lib/private/AvatarManager.php +++ b/lib/private/AvatarManager.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -29,6 +30,7 @@ namespace OC; use OCP\Files\IAppData; use OCP\Files\NotFoundException; +use OCP\IAvatar; use OCP\IAvatarManager; use OCP\IConfig; use OCP\ILogger; @@ -85,9 +87,9 @@ class AvatarManager implements IAvatarManager { * @throws \Exception In case the username is potentially dangerous * @throws NotFoundException In case there is no user folder yet */ - public function getAvatar($userId) { + public function getAvatar(string $userId) : IAvatar { $user = $this->userManager->get($userId); - if (is_null($user)) { + if ($user === null) { throw new \Exception('user does not exist'); } diff --git a/lib/public/IAvatarManager.php b/lib/public/IAvatarManager.php index 04f4cd00d0d..19e4b93503a 100644 --- a/lib/public/IAvatarManager.php +++ b/lib/public/IAvatarManager.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -35,12 +36,12 @@ interface IAvatarManager { /** * return a user specific instance of \OCP\IAvatar - * @see \OCP\IAvatar + * @see IAvatar * @param string $user the ownCloud user id - * @return \OCP\IAvatar + * @return IAvatar * @throws \Exception In case the username is potentially dangerous * @throws \OCP\Files\NotFoundException In case there is no user folder yet * @since 6.0.0 */ - public function getAvatar($user); + public function getAvatar(string $user) : IAvatar; } |