Skip to content

Commit 193e9f5

Browse files
committed
Add type hints & remove unnecessary doc block type hints
1 parent 1389b46 commit 193e9f5

File tree

12 files changed

+10
-80
lines changed

12 files changed

+10
-80
lines changed

phpcs.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@
7878
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
7979
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
8080
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
81+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
82+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint"/>
83+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
84+
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/>
8185
<rule ref="SlevomatCodingStandard.TypeHints.DNFTypeHintFormat">
8286
<properties>
8387
<property name="withSpacesAroundOperators" value="no" />

src/Authenticator.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,13 @@ class Authenticator
1313
{
1414
/**
1515
* Create new instance
16-
*
17-
* @param VaultInterface $vault
18-
* @return void
1916
*/
2017
public function __construct(protected VaultInterface $vault)
2118
{
2219
}
2320

2421
/**
2522
* Create HTTP basic auth instance
26-
*
27-
* @param string $username
28-
* @param string $password
29-
* @param string $realm
30-
* @return Authenticator
3123
*/
3224
public static function basic(string $username, string $password, string $realm = 'Secured Area'): self
3325
{
@@ -36,11 +28,6 @@ public static function basic(string $username, string $password, string $realm =
3628

3729
/**
3830
* Create HTTP digest auth instance
39-
*
40-
* @param string $username
41-
* @param string $password
42-
* @param string $realm
43-
* @return Authenticator
4431
*/
4532
public static function digest(string $username, string $password, string $realm = 'Secured Area'): self
4633
{
@@ -49,9 +36,6 @@ public static function digest(string $username, string $password, string $realm
4936

5037
/**
5138
* Create auth instance
52-
*
53-
* @param VaultInterface $vault
54-
* @return Authenticator
5539
*/
5640
public static function withVault(VaultInterface $vault): self
5741
{
@@ -62,7 +46,6 @@ public static function withVault(VaultInterface $vault): self
6246
* Create vault by current parameters and secure it
6347
*
6448
* @throws NotSupportedException
65-
* @return void
6649
*/
6750
public function secure(?string $message = null): void
6851
{

src/Environment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Environment implements EnvironmentInterface
1515
*
1616
* @var array<string>
1717
*/
18-
protected static $tokenClassnames = [
18+
protected static array $tokenClassnames = [
1919
Tokens\PhpAuthUser::class,
2020
Tokens\HttpAuthentification::class,
2121
Tokens\RedirectHttpAuthorization::class,

src/Interfaces/DirectiveInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ interface DirectiveInterface
88
{
99
/**
1010
* Cast directive to string
11-
*
12-
* @return string
1311
*/
1412
public function __toString(): string;
1513
}

src/Interfaces/EnvironmentInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ interface EnvironmentInterface
1212
* Try to parse and return auth token from server environment
1313
*
1414
* @throws AuthentificationException
15-
* @return TokenInterface
1615
*/
1716
public static function token(): TokenInterface;
1817
}

src/Interfaces/TokenInterface.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,71 +15,51 @@ public function parse(): array;
1515

1616
/**
1717
* Access username of token
18-
*
19-
* @return null|string
2018
*/
2119
public function username(): ?string;
2220

2321
/**
2422
* Access password of token
25-
*
26-
* @return null|string
2723
*/
2824
public function password(): ?string;
2925

3026
/**
3127
* Access cnonce of token
32-
*
33-
* @return null|string
3428
*/
3529
public function cnonce(): ?string;
3630

3731
/**
3832
* Access nc of token
39-
*
40-
* @return null|string
4133
*/
4234
public function nc(): ?string;
4335

4436
/**
4537
* Access nonce of token
46-
*
47-
* @return null|string
4838
*/
4939
public function nonce(): ?string;
5040

5141
/**
5242
* Access qop of token
53-
*
54-
* @return null|string
5543
*/
5644
public function qop(): ?string;
5745

5846
/**
5947
* Access response of token
60-
*
61-
* @return null|string
6248
*/
6349
public function response(): ?string;
6450

6551
/**
6652
* Access uri of token
67-
*
68-
* @return null|string
6953
*/
7054
public function uri(): ?string;
7155

7256
/**
7357
* Access realm of token
74-
*
75-
* @return null|string
7658
*/
7759
public function realm(): ?string;
7860

7961
/**
8062
* Access opaque of token
81-
*
82-
* @return null|string
8363
*/
8464
public function opaque(): ?string;
8565
}

src/Interfaces/VaultInterface.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ interface VaultInterface
1111
{
1212
/**
1313
* Deny access for non-authenticated users
14-
*
15-
* @param null|string $message
16-
* @return void
1714
*/
1815
public function secure(?string $message = null): void;
1916

@@ -22,21 +19,16 @@ public function secure(?string $message = null): void;
2219
* verification fails
2320
*
2421
* @throws AuthentificationException
25-
* @return void
2622
*/
2723
public function verify(TokenInterface $token): void;
2824

2925
/**
3026
* Type identifier of vault
31-
*
32-
* @return Type
3327
*/
3428
public function type(): Type;
3529

3630
/**
3731
* Build directive for current vault based on credentials and type
38-
*
39-
* @return DirectiveInterface
4032
*/
4133
public function directive(): DirectiveInterface;
4234
}

src/Tokens/AbstractToken.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ public function opaque(): ?string
130130
* Returns null if key doesn't exists
131131
*
132132
* @param array<mixed> $data
133-
* @param mixed $key
134-
* @return mixed
135133
*/
136134
protected function getArrayValue(array $data, mixed $key): mixed
137135
{

src/Vaults/AbstractVault.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ abstract class AbstractVault implements VaultInterface
1414
{
1515
/**
1616
* Create new instance
17-
*
18-
* @param string $username
19-
* @param string $password
20-
* @param string $realm
2117
*/
2218
public function __construct(
2319
#[SensitiveParameter] protected string $username,
@@ -52,9 +48,6 @@ public function secure(?string $message = null): void
5248

5349
/**
5450
* Set name of realm
55-
*
56-
* @param string $realm
57-
* @return AbstractVault
5851
*/
5952
public function setRealm(string $realm): self
6053
{
@@ -65,8 +58,6 @@ public function setRealm(string $realm): self
6558

6659
/**
6760
* Return current realm name
68-
*
69-
* @return string
7061
*/
7162
public function realm(): string
7263
{
@@ -75,8 +66,6 @@ public function realm(): string
7566

7667
/**
7768
* Set username for current vault
78-
*
79-
* @param string $username
8069
*/
8170
public function setUsername(string $username): self
8271
{
@@ -87,8 +76,6 @@ public function setUsername(string $username): self
8776

8877
/**
8978
* Return current username
90-
*
91-
* @return string
9279
*/
9380
public function username(): string
9481
{
@@ -97,9 +84,6 @@ public function username(): string
9784

9885
/**
9986
* Set password for current vault
100-
*
101-
* @param string $password
102-
* @return AbstractVault
10387
*/
10488
public function setPassword(string $password): self
10589
{
@@ -110,8 +94,6 @@ public function setPassword(string $password): self
11094

11195
/**
11296
* Return current password
113-
*
114-
* @return string
11597
*/
11698
public function password(): string
11799
{
@@ -120,10 +102,6 @@ public function password(): string
120102

121103
/**
122104
* Set username and password at once
123-
*
124-
* @param string $username
125-
* @param string $password
126-
* @return AbstractVault
127105
*/
128106
public function setCredentials(string $username, string $password): self
129107
{
@@ -132,8 +110,6 @@ public function setCredentials(string $username, string $password): self
132110

133111
/**
134112
* Send HTTP 401 Header
135-
*
136-
* @return void
137113
*/
138114
protected function denyAccess(?string $message = null): void
139115
{

src/Vaults/DigestVault.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ public function directive(): DirectiveInterface
5555

5656
/**
5757
* Build and return hash from given token
58-
*
59-
* @param TokenInterface $token
60-
* @return string
6158
*/
6259
private function tokenHash(TokenInterface $token): string
6360
{

0 commit comments

Comments
 (0)