Browse Source

More type safety

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/34624/head
Carl Schwan 3 years ago
parent
commit
9319bbb00c
  1. 4
      apps/files_external/lib/Lib/Auth/AuthMechanism.php
  2. 14
      apps/files_external/lib/Lib/Backend/Backend.php
  3. 6
      apps/files_external/lib/Lib/FrontendDefinitionTrait.php
  4. 6
      apps/files_external/lib/Lib/IFrontendDefinition.php
  5. 10
      apps/files_external/lib/Lib/MissingDependency.php

4
apps/files_external/lib/Lib/Auth/AuthMechanism.php

@ -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';

14
apps/files_external/lib/Lib/Backend/Backend.php

@ -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;
}
/**

6
apps/files_external/lib/Lib/FrontendDefinitionTrait.php

@ -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) {

6
apps/files_external/lib/Lib/IFrontendDefinition.php

@ -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;

10
apps/files_external/lib/Lib/MissingDependency.php

@ -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…
Cancel
Save