Skip to content

Commit 6e66de8

Browse files
Add return types to internal|final|private methods
1 parent 9b55875 commit 6e66de8

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

Authentication/RememberMe/PersistentToken.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,39 +49,39 @@ public function __construct(string $class, string $username, string $series, str
4949
/**
5050
* {@inheritdoc}
5151
*/
52-
public function getClass()
52+
public function getClass(): string
5353
{
5454
return $this->class;
5555
}
5656

5757
/**
5858
* {@inheritdoc}
5959
*/
60-
public function getUsername()
60+
public function getUsername(): string
6161
{
6262
return $this->username;
6363
}
6464

6565
/**
6666
* {@inheritdoc}
6767
*/
68-
public function getSeries()
68+
public function getSeries(): string
6969
{
7070
return $this->series;
7171
}
7272

7373
/**
7474
* {@inheritdoc}
7575
*/
76-
public function getTokenValue()
76+
public function getTokenValue(): string
7777
{
7878
return $this->tokenValue;
7979
}
8080

8181
/**
8282
* {@inheritdoc}
8383
*/
84-
public function getLastUsed()
84+
public function getLastUsed(): \DateTime
8585
{
8686
return $this->lastUsed;
8787
}

Authorization/AuthorizationChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(TokenStorageInterface $tokenStorage, AuthenticationM
4343
*
4444
* @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token
4545
*/
46-
final public function isGranted($attributes, $subject = null)
46+
final public function isGranted($attributes, $subject = null): bool
4747
{
4848
if (null === ($token = $this->tokenStorage->getToken())) {
4949
throw new AuthenticationCredentialsNotFoundException('The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL.');

Authorization/TraceableAccessDecisionManager.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(AccessDecisionManagerInterface $manager)
4848
/**
4949
* {@inheritdoc}
5050
*/
51-
public function decide(TokenInterface $token, array $attributes, $object = null)
51+
public function decide(TokenInterface $token, array $attributes, $object = null): bool
5252
{
5353
$currentDecisionLog = [
5454
'attributes' => $attributes,
@@ -86,7 +86,7 @@ public function addVoterVote(VoterInterface $voter, array $attributes, int $vote
8686
/**
8787
* @return string
8888
*/
89-
public function getStrategy()
89+
public function getStrategy(): string
9090
{
9191
// The $strategy property is misleading because it stores the name of its
9292
// method (e.g. 'decideAffirmative') instead of the original strategy name
@@ -97,15 +97,15 @@ public function getStrategy()
9797
/**
9898
* @return iterable|VoterInterface[]
9999
*/
100-
public function getVoters()
100+
public function getVoters(): iterable
101101
{
102102
return $this->voters;
103103
}
104104

105105
/**
106106
* @return array
107107
*/
108-
public function getDecisionLog()
108+
public function getDecisionLog(): array
109109
{
110110
return $this->decisionLog;
111111
}

Security.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,14 @@ public function getUser()
6161
*
6262
* @param mixed $attributes
6363
* @param mixed $subject
64-
*
65-
* @return bool
6664
*/
67-
public function isGranted($attributes, $subject = null)
65+
public function isGranted($attributes, $subject = null): bool
6866
{
6967
return $this->container->get('security.authorization_checker')
7068
->isGranted($attributes, $subject);
7169
}
7270

73-
/**
74-
* @return TokenInterface|null
75-
*/
76-
public function getToken()
71+
public function getToken(): ?TokenInterface
7772
{
7873
return $this->container->get('security.token_storage')->getToken();
7974
}

User/MissingUserProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@ public function __construct(string $firewall)
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function loadUserByUsername($username)
35+
public function loadUserByUsername($username): UserInterface
3636
{
3737
throw new \BadMethodCallException();
3838
}
3939

4040
/**
4141
* {@inheritdoc}
4242
*/
43-
public function refreshUser(UserInterface $user)
43+
public function refreshUser(UserInterface $user): UserInterface
4444
{
4545
throw new \BadMethodCallException();
4646
}
4747

4848
/**
4949
* {@inheritdoc}
5050
*/
51-
public function supportsClass($class)
51+
public function supportsClass($class): bool
5252
{
5353
throw new \BadMethodCallException();
5454
}

0 commit comments

Comments
 (0)