mirror of
https://github.com/nextcloud/server.git
synced 2026-04-28 09:37:29 -04:00
More type safety
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
parent
3790ff86f1
commit
9319bbb00c
5 changed files with 15 additions and 25 deletions
|
|
@ -30,7 +30,7 @@ use OCA\Files_External\Lib\StorageConfig;
|
|||
use OCA\Files_External\Lib\StorageModifierTrait;
|
||||
use OCA\Files_External\Lib\VisibilityTrait;
|
||||
use OCA\Files_External\Lib\IIdentifier;
|
||||
use OCA\Files_External\Lib\IFrontendDefintion;
|
||||
use OCA\Files_External\Lib\IFrontendDefinition;
|
||||
|
||||
/**
|
||||
* Authentication mechanism
|
||||
|
|
@ -52,7 +52,7 @@ use OCA\Files_External\Lib\IFrontendDefintion;
|
|||
* - StorageModifierTrait
|
||||
* Object can affect storage mounting
|
||||
*/
|
||||
class AuthMechanism implements \JsonSerializable, IIdentifier, IFrontendDefintion {
|
||||
class AuthMechanism implements \JsonSerializable, IIdentifier, IFrontendDefinition {
|
||||
/** Standard authentication schemes */
|
||||
public const SCHEME_NULL = 'null';
|
||||
public const SCHEME_BUILTIN = 'builtin';
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ use OCA\Files_External\Lib\StorageConfig;
|
|||
use OCA\Files_External\Lib\StorageModifierTrait;
|
||||
use OCA\Files_External\Lib\VisibilityTrait;
|
||||
use OCA\Files_External\Lib\IIdentifier;
|
||||
use OCA\Files_External\Lib\IFrontendDefintion;
|
||||
use OCA\Files_External\Lib\IFrontendDefinition;
|
||||
|
||||
/**
|
||||
* Storage backend
|
||||
|
|
@ -57,7 +57,7 @@ use OCA\Files_External\Lib\IFrontendDefintion;
|
|||
* - StorageModifierTrait
|
||||
* Object can affect storage mounting
|
||||
*/
|
||||
class Backend implements \JsonSerializable, IIdentifier, IFrontendDefintion {
|
||||
class Backend implements \JsonSerializable, IIdentifier, IFrontendDefinition {
|
||||
use VisibilityTrait;
|
||||
use FrontendDefinitionTrait;
|
||||
use PriorityTrait;
|
||||
|
|
@ -120,21 +120,17 @@ class Backend implements \JsonSerializable, IIdentifier, IFrontendDefintion {
|
|||
return $this->legacyAuthMechanism;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AuthMechanism $authMechanism
|
||||
* @return self
|
||||
*/
|
||||
public function setLegacyAuthMechanism(AuthMechanism $authMechanism) {
|
||||
public function setLegacyAuthMechanism(AuthMechanism $authMechanism): self {
|
||||
$this->legacyAuthMechanism = $authMechanism;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $callback dynamic auth mechanism selection
|
||||
* @return self
|
||||
*/
|
||||
public function setLegacyAuthMechanismCallback(callable $callback) {
|
||||
public function setLegacyAuthMechanismCallback(callable $callback): self {
|
||||
$this->legacyAuthMechanism = $callback;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ trait FrontendDefinitionTrait {
|
|||
/** @var string human-readable mechanism name */
|
||||
private string $text = "";
|
||||
|
||||
/** @var DefinitionParameter[] parameters for mechanism */
|
||||
/** @var array<string, DefinitionParameter> parameters for mechanism */
|
||||
private array $parameters = [];
|
||||
|
||||
/** @var string[] custom JS */
|
||||
|
|
@ -51,14 +51,14 @@ trait FrontendDefinitionTrait {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return DefinitionParameter[]
|
||||
* @return array<string, DefinitionParameter>
|
||||
*/
|
||||
public function getParameters(): array {
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DefinitionParameter[] $parameters
|
||||
* @param list<DefinitionParameter> $parameters
|
||||
*/
|
||||
public function addParameters(array $parameters): self {
|
||||
foreach ($parameters as $parameter) {
|
||||
|
|
|
|||
|
|
@ -19,19 +19,19 @@
|
|||
*/
|
||||
namespace OCA\Files_External\Lib;
|
||||
|
||||
interface IFrontendDefintion {
|
||||
interface IFrontendDefinition {
|
||||
|
||||
public function getText(): string;
|
||||
|
||||
public function setText(string $text): self;
|
||||
|
||||
/**
|
||||
* @return list<DefinitionParameter>
|
||||
* @return array<string, DefinitionParameter>
|
||||
*/
|
||||
public function getParameters(): array;
|
||||
|
||||
/**
|
||||
* @param DefinitionParameter[] $parameters
|
||||
* @param list<DefinitionParameter> $parameters
|
||||
*/
|
||||
public function addParameters(array $parameters): self;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,17 +39,11 @@ class MissingDependency {
|
|||
$this->dependency = $dependency;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDependency() {
|
||||
public function getDependency(): string {
|
||||
return $this->dependency;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage() {
|
||||
public function getMessage(): ?string {
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue