Skip to content

Commit 50ccd82

Browse files
derrabusTobion
authored andcommitted
Add types to constructors and private/final/internal methods (Batch II)
1 parent 6f78ca3 commit 50ccd82

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function __toString()
299299
return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUsername(), json_encode($this->authenticated), implode(', ', $roles));
300300
}
301301

302-
private function hasUserChanged(UserInterface $user)
302+
private function hasUserChanged(UserInterface $user): bool
303303
{
304304
if (!($this->user instanceof UserInterface)) {
305305
throw new \BadMethodCallException('Method "hasUserChanged" should be called when current user class is instance of "UserInterface".');

Authorization/Voter/ExpressionVoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function vote(TokenInterface $token, $subject, array $attributes)
9393
return $result;
9494
}
9595

96-
private function getVariables(TokenInterface $token, $subject)
96+
private function getVariables(TokenInterface $token, $subject): array
9797
{
9898
if (method_exists($token, 'getRoleNames')) {
9999
$roleNames = $token->getRoleNames();

Encoder/Argon2iPasswordEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ public function isPasswordValid($encoded, $raw, $salt)
102102
throw new \LogicException('Argon2i algorithm is not supported. Please install the libsodium extension or upgrade to PHP 7.2+.');
103103
}
104104

105-
private function encodePasswordNative(string $raw)
105+
private function encodePasswordNative(string $raw): string
106106
{
107107
return password_hash($raw, \PASSWORD_ARGON2I, $this->config);
108108
}
109109

110-
private function encodePasswordSodiumFunction(string $raw)
110+
private function encodePasswordSodiumFunction(string $raw): string
111111
{
112112
$hash = sodium_crypto_pwhash_str(
113113
$raw,
@@ -119,7 +119,7 @@ private function encodePasswordSodiumFunction(string $raw)
119119
return $hash;
120120
}
121121

122-
private function encodePasswordSodiumExtension(string $raw)
122+
private function encodePasswordSodiumExtension(string $raw): string
123123
{
124124
$hash = \Sodium\crypto_pwhash_str(
125125
$raw,

Encoder/EncoderFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private function createEncoder(array $config): PasswordEncoderInterface
8080
return $reflection->newInstanceArgs($config['arguments']);
8181
}
8282

83-
private function getEncoderConfigFromAlgorithm(array $config)
83+
private function getEncoderConfigFromAlgorithm(array $config): array
8484
{
8585
if ('auto' === $config['algorithm']) {
8686
$encoderChain = [];

User/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __toString(): string
5353
/**
5454
* {@inheritdoc}
5555
*/
56-
public function getRoles()
56+
public function getRoles(): array
5757
{
5858
return $this->roles;
5959
}

0 commit comments

Comments
 (0)