Skip to content

Commit e2eff18

Browse files
mbuliardnicolas-grekas
authored andcommitted
[Security] Add missing void PHPdoc return types
1 parent b72dc84 commit e2eff18

File tree

7 files changed

+36
-4
lines changed

7 files changed

+36
-4
lines changed

Authentication/RememberMe/TokenProviderInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,24 @@ public function loadTokenBySeries(string $series);
3131

3232
/**
3333
* Deletes all tokens belonging to series.
34+
*
35+
* @return void
3436
*/
3537
public function deleteTokenBySeries(string $series);
3638

3739
/**
3840
* Updates the token according to this data.
3941
*
42+
* @return void
43+
*
4044
* @throws TokenNotFoundException if the token is not found
4145
*/
4246
public function updateToken(string $series, #[\SensitiveParameter] string $tokenValue, \DateTime $lastUsed);
4347

4448
/**
4549
* Creates a new token.
50+
*
51+
* @return void
4652
*/
4753
public function createNewToken(PersistentTokenInterface $token);
4854
}

Authentication/Token/NullToken.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public function getUser(): ?UserInterface
3333
return null;
3434
}
3535

36+
/**
37+
* @return never
38+
*/
3639
public function setUser(UserInterface $user)
3740
{
3841
throw new \BadMethodCallException('Cannot set user on a NullToken.');
@@ -55,6 +58,9 @@ public function getAttributes(): array
5558
return [];
5659
}
5760

61+
/**
62+
* @return never
63+
*/
5864
public function setAttributes(array $attributes)
5965
{
6066
throw new \BadMethodCallException('Cannot set attributes of NullToken.');
@@ -70,6 +76,9 @@ public function getAttribute(string $name): mixed
7076
return null;
7177
}
7278

79+
/**
80+
* @return never
81+
*/
7382
public function setAttribute(string $name, mixed $value)
7483
{
7584
throw new \BadMethodCallException('Cannot add attribute to NullToken.');

Authentication/Token/Storage/TokenStorageInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public function getToken(): ?TokenInterface;
2929
* Sets the authentication token.
3030
*
3131
* @param TokenInterface|null $token A TokenInterface token, or null if no further authentication information should be stored
32+
*
33+
* @return void
3234
*/
3335
public function setToken(?TokenInterface $token);
3436
}

Authentication/Token/TokenInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,25 @@ public function getUser(): ?UserInterface;
5050
/**
5151
* Sets the authenticated user in the token.
5252
*
53+
* @return void
54+
*
5355
* @throws \InvalidArgumentException
5456
*/
5557
public function setUser(UserInterface $user);
5658

5759
/**
5860
* Removes sensitive information from the token.
61+
*
62+
* @return void
5963
*/
6064
public function eraseCredentials();
6165

6266
public function getAttributes(): array;
6367

6468
/**
6569
* @param array $attributes The token attributes
70+
*
71+
* @return void
6672
*/
6773
public function setAttributes(array $attributes);
6874

@@ -73,6 +79,9 @@ public function hasAttribute(string $name): bool;
7379
*/
7480
public function getAttribute(string $name): mixed;
7581

82+
/**
83+
* @return void
84+
*/
7685
public function setAttribute(string $name, mixed $value);
7786

7887
/**

Tests/Authentication/AuthenticationTrustResolverTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function getUser(): UserInterface
111111
return new InMemoryUser('wouter', '', ['ROLE_USER']);
112112
}
113113

114-
public function setUser($user)
114+
public function setUser($user): void
115115
{
116116
}
117117

@@ -123,15 +123,15 @@ public function getUserIdentifier(): string
123123
{
124124
}
125125

126-
public function eraseCredentials()
126+
public function eraseCredentials(): void
127127
{
128128
}
129129

130130
public function getAttributes(): array
131131
{
132132
}
133133

134-
public function setAttributes(array $attributes)
134+
public function setAttributes(array $attributes): void
135135
{
136136
}
137137

@@ -143,7 +143,7 @@ public function getAttribute(string $name): mixed
143143
{
144144
}
145145

146-
public function setAttribute(string $name, $value)
146+
public function setAttribute(string $name, $value): void
147147
{
148148
}
149149
}

User/UserCheckerInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ interface UserCheckerInterface
2626
/**
2727
* Checks the user account before authentication.
2828
*
29+
* @return void
30+
*
2931
* @throws AccountStatusException
3032
*/
3133
public function checkPreAuth(UserInterface $user);
3234

3335
/**
3436
* Checks the user account after authentication.
3537
*
38+
* @return void
39+
*
3640
* @throws AccountStatusException
3741
*/
3842
public function checkPostAuth(UserInterface $user);

User/UserInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public function getRoles(): array;
5151
*
5252
* This is important if, at any given point, sensitive information like
5353
* the plain-text password is stored on this object.
54+
*
55+
* @return void
5456
*/
5557
public function eraseCredentials();
5658

0 commit comments

Comments
 (0)