Преглед на файлове

Add return type hint to credential store and make it strict

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v18.0.0beta1
Christoph Wurst преди 4 години
родител
ревизия
128a460d7b
No account linked to committer's email address
променени са 2 файла, в които са добавени 9 реда и са изтрити 7 реда
  1. 4
    3
      lib/private/Authentication/LoginCredentials/Store.php
  2. 5
    4
      lib/public/Authentication/LoginCredentials/IStore.php

+ 4
- 3
lib/private/Authentication/LoginCredentials/Store.php Целия файл

@@ -1,4 +1,5 @@
<?php
<?php declare(strict_types=1);

/**
* @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
* @throws CredentialsUnavailableException
*/
public function getLoginCredentials() {
if (is_null($this->tokenProvider)) {
public function getLoginCredentials(): ICredentials {
if ($this->tokenProvider === null) {
throw new CredentialsUnavailableException();
}


+ 5
- 4
lib/public/Authentication/LoginCredentials/IStore.php Целия файл

@@ -1,4 +1,5 @@
<?php
<?php declare(strict_types=1);

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

Loading…
Отказ
Запис