Skip to content

Commit 9319bbb

Browse files
committed
More type safety
Signed-off-by: Carl Schwan <[email protected]>
1 parent 3790ff8 commit 9319bbb

File tree

5 files changed

+15
-25
lines changed

5 files changed

+15
-25
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
use OCA\Files_External\Lib\StorageModifierTrait;
3131
use OCA\Files_External\Lib\VisibilityTrait;
3232
use OCA\Files_External\Lib\IIdentifier;
33-
use OCA\Files_External\Lib\IFrontendDefintion;
33+
use OCA\Files_External\Lib\IFrontendDefinition;
3434

3535
/**
3636
* Authentication mechanism
@@ -52,7 +52,7 @@
5252
* - StorageModifierTrait
5353
* Object can affect storage mounting
5454
*/
55-
class AuthMechanism implements \JsonSerializable, IIdentifier, IFrontendDefintion {
55+
class AuthMechanism implements \JsonSerializable, IIdentifier, IFrontendDefinition {
5656
/** Standard authentication schemes */
5757
public const SCHEME_NULL = 'null';
5858
public const SCHEME_BUILTIN = 'builtin';

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
use OCA\Files_External\Lib\StorageModifierTrait;
3232
use OCA\Files_External\Lib\VisibilityTrait;
3333
use OCA\Files_External\Lib\IIdentifier;
34-
use OCA\Files_External\Lib\IFrontendDefintion;
34+
use OCA\Files_External\Lib\IFrontendDefinition;
3535

3636
/**
3737
* Storage backend
@@ -57,7 +57,7 @@
5757
* - StorageModifierTrait
5858
* Object can affect storage mounting
5959
*/
60-
class Backend implements \JsonSerializable, IIdentifier, IFrontendDefintion {
60+
class Backend implements \JsonSerializable, IIdentifier, IFrontendDefinition {
6161
use VisibilityTrait;
6262
use FrontendDefinitionTrait;
6363
use PriorityTrait;
@@ -120,21 +120,17 @@ public function getLegacyAuthMechanism(array $parameters = []) {
120120
return $this->legacyAuthMechanism;
121121
}
122122

123-
/**
124-
* @param AuthMechanism $authMechanism
125-
* @return self
126-
*/
127-
public function setLegacyAuthMechanism(AuthMechanism $authMechanism) {
123+
public function setLegacyAuthMechanism(AuthMechanism $authMechanism): self {
128124
$this->legacyAuthMechanism = $authMechanism;
129125
return $this;
130126
}
131127

132128
/**
133129
* @param callable $callback dynamic auth mechanism selection
134-
* @return self
135130
*/
136-
public function setLegacyAuthMechanismCallback(callable $callback) {
131+
public function setLegacyAuthMechanismCallback(callable $callback): self {
137132
$this->legacyAuthMechanism = $callback;
133+
return $this;
138134
}
139135

140136
/**

apps/files_external/lib/Lib/FrontendDefinitionTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ trait FrontendDefinitionTrait {
3131
/** @var string human-readable mechanism name */
3232
private string $text = "";
3333

34-
/** @var DefinitionParameter[] parameters for mechanism */
34+
/** @var array<string, DefinitionParameter> parameters for mechanism */
3535
private array $parameters = [];
3636

3737
/** @var string[] custom JS */
@@ -51,14 +51,14 @@ public static function lexicalCompare(IFrontendDefinition $a, IFrontendDefinitio
5151
}
5252

5353
/**
54-
* @return DefinitionParameter[]
54+
* @return array<string, DefinitionParameter>
5555
*/
5656
public function getParameters(): array {
5757
return $this->parameters;
5858
}
5959

6060
/**
61-
* @param DefinitionParameter[] $parameters
61+
* @param list<DefinitionParameter> $parameters
6262
*/
6363
public function addParameters(array $parameters): self {
6464
foreach ($parameters as $parameter) {

apps/files_external/lib/Lib/IFrontendDefinition.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
*/
2020
namespace OCA\Files_External\Lib;
2121

22-
interface IFrontendDefintion {
22+
interface IFrontendDefinition {
2323

2424
public function getText(): string;
2525

2626
public function setText(string $text): self;
2727

2828
/**
29-
* @return list<DefinitionParameter>
29+
* @return array<string, DefinitionParameter>
3030
*/
3131
public function getParameters(): array;
3232

3333
/**
34-
* @param DefinitionParameter[] $parameters
34+
* @param list<DefinitionParameter> $parameters
3535
*/
3636
public function addParameters(array $parameters): self;
3737

apps/files_external/lib/Lib/MissingDependency.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,11 @@ public function __construct($dependency) {
3939
$this->dependency = $dependency;
4040
}
4141

42-
/**
43-
* @return string
44-
*/
45-
public function getDependency() {
42+
public function getDependency(): string {
4643
return $this->dependency;
4744
}
4845

49-
/**
50-
* @return string|null
51-
*/
52-
public function getMessage() {
46+
public function getMessage(): ?string {
5347
return $this->message;
5448
}
5549

0 commit comments

Comments
 (0)