]> source.dussan.org Git - nextcloud-server.git/commitdiff
More type safety
authorCarl Schwan <carl@carlschwan.eu>
Mon, 17 Oct 2022 09:50:32 +0000 (11:50 +0200)
committerCarl Schwan <carl@carlschwan.eu>
Mon, 17 Oct 2022 09:53:11 +0000 (11:53 +0200)
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
apps/files_external/lib/Lib/Auth/AuthMechanism.php
apps/files_external/lib/Lib/Backend/Backend.php
apps/files_external/lib/Lib/FrontendDefinitionTrait.php
apps/files_external/lib/Lib/IFrontendDefinition.php
apps/files_external/lib/Lib/MissingDependency.php

index 16354fa37fab09cb4c50ca7d0bbc4b70d9c755ea..e43f6d06b479659c9ede7efba5f7f71aff3b51cc 100644 (file)
@@ -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';
index afedfd213eb6574a9e02ad328976e474b9af4345..845f51f54327df8f91f51e210e454347e5672e5b 100644 (file)
@@ -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;
        }
 
        /**
index 6b2dc8672f32eeb61820501dcb428019694fa798..fd72b2fa7aa84367ed9b6c28b9499e4b0d3f1f32 100644 (file)
@@ -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) {
index 1a518a4ee762c2789f608121d76417140b91dcd0..3c625c21c15ccf69f298f8f9547f4cfa64d7a513 100644 (file)
  */
 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;
 
index b740f4596b24569a71eb320d2d087c71bf37b9ba..a8e9f9ecc456dd87d82655befbc7f31620be1ded 100644 (file)
@@ -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;
        }