Add return type hint to credential store and make it strict

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2019-11-25 15:59:55 +01:00
parent 279c0cb2ed
commit 128a460d7b
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
2 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,5 @@
<?php <?php declare(strict_types=1);
/** /**
* @copyright 2016 Christoph Wurst <christoph@winzerhof-wurst.at> * @copyright 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
* *
@ -82,8 +83,8 @@ class Store implements IStore {
* @return ICredentials the login credentials of the current user * @return ICredentials the login credentials of the current user
* @throws CredentialsUnavailableException * @throws CredentialsUnavailableException
*/ */
public function getLoginCredentials() { public function getLoginCredentials(): ICredentials {
if (is_null($this->tokenProvider)) { if ($this->tokenProvider === null) {
throw new CredentialsUnavailableException(); throw new CredentialsUnavailableException();
} }

View File

@ -1,4 +1,5 @@
<?php <?php declare(strict_types=1);
/** /**
* @copyright 2016 Christoph Wurst <christoph@winzerhof-wurst.at> * @copyright 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
* *
@ -29,7 +30,7 @@ use OCP\Authentication\Exceptions\CredentialsUnavailableException;
* @since 12 * @since 12
*/ */
interface IStore { interface IStore {
/** /**
* Get login credentials of the currently logged in user * Get login credentials of the currently logged in user
* *
@ -38,6 +39,6 @@ interface IStore {
* @throws CredentialsUnavailableException * @throws CredentialsUnavailableException
* @return ICredentials the login credentials of the current user * @return ICredentials the login credentials of the current user
*/ */
public function getLoginCredentials(); public function getLoginCredentials(): ICredentials;
} }