Skip to content

Commit 1863bd4

Browse files
[Security/Core] fix some annotations
1 parent 071d8da commit 1863bd4

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

Authentication/Token/AbstractToken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class AbstractToken implements TokenInterface
3131
private $attributes = [];
3232

3333
/**
34-
* @param (RoleInterface|string)[] $roles An array of roles
34+
* @param (Role|string)[] $roles An array of roles
3535
*
3636
* @throws \InvalidArgumentException
3737
*/
@@ -41,7 +41,7 @@ public function __construct(array $roles = [])
4141
if (\is_string($role)) {
4242
$role = new Role($role);
4343
} elseif (!$role instanceof RoleInterface) {
44-
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, Role instances or RoleInterface instances, but got %s.', \gettype($role)));
44+
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, Role instances, but got %s.', \gettype($role)));
4545
}
4646

4747
$this->roles[] = $role;

Authentication/Token/AnonymousToken.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Security\Core\Authentication\Token;
1313

1414
use Symfony\Component\Security\Core\Role\Role;
15+
use Symfony\Component\Security\Core\User\UserInterface;
1516

1617
/**
1718
* AnonymousToken represents an anonymous token.
@@ -23,9 +24,9 @@ class AnonymousToken extends AbstractToken
2324
private $secret;
2425

2526
/**
26-
* @param string $secret A secret used to make sure the token is created by the app and not by a malicious client
27-
* @param string|object $user The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string
28-
* @param Role[] $roles An array of roles
27+
* @param string $secret A secret used to make sure the token is created by the app and not by a malicious client
28+
* @param string|\Stringable|UserInterface $user
29+
* @param (Role|string)[] $roles
2930
*/
3031
public function __construct($secret, $user, array $roles = [])
3132
{

Authentication/Token/PreAuthenticatedToken.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
namespace Symfony\Component\Security\Core\Authentication\Token;
1313

14-
use Symfony\Component\Security\Core\Role\RoleInterface;
14+
use Symfony\Component\Security\Core\Role\Role;
15+
use Symfony\Component\Security\Core\User\UserInterface;
1516

1617
/**
1718
* PreAuthenticatedToken implements a pre-authenticated token.
@@ -24,10 +25,10 @@ class PreAuthenticatedToken extends AbstractToken
2425
private $providerKey;
2526

2627
/**
27-
* @param string|object $user The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string
28-
* @param mixed $credentials The user credentials
29-
* @param string $providerKey The provider key
30-
* @param (RoleInterface|string)[] $roles An array of roles
28+
* @param string|\Stringable|UserInterface $user
29+
* @param mixed $credentials
30+
* @param string $providerKey
31+
* @param (Role|string)[] $roles
3132
*/
3233
public function __construct($user, $credentials, $providerKey, array $roles = [])
3334
{

Authentication/Token/TokenInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Security\Core\Authentication\Token;
1313

1414
use Symfony\Component\Security\Core\Role\RoleInterface;
15+
use Symfony\Component\Security\Core\User\UserInterface;
1516

1617
/**
1718
* TokenInterface is the interface for the user authentication information.
@@ -47,8 +48,7 @@ public function getCredentials();
4748
/**
4849
* Returns a user representation.
4950
*
50-
* @return string|object Can be a UserInterface instance, an object implementing a __toString method,
51-
* or the username as a regular string
51+
* @return string|\Stringable|UserInterface
5252
*
5353
* @see AbstractToken::setUser()
5454
*/
@@ -60,7 +60,7 @@ public function getUser();
6060
* The user can be a UserInterface instance, or an object implementing
6161
* a __toString method or the username as a regular string.
6262
*
63-
* @param string|object $user The user
63+
* @param string|\Stringable|UserInterface $user
6464
*
6565
* @throws \InvalidArgumentException
6666
*/

Authentication/Token/UsernamePasswordToken.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
namespace Symfony\Component\Security\Core\Authentication\Token;
1313

14-
use Symfony\Component\Security\Core\Role\RoleInterface;
14+
use Symfony\Component\Security\Core\Role\Role;
15+
use Symfony\Component\Security\Core\User\UserInterface;
1516

1617
/**
1718
* UsernamePasswordToken implements a username and password token.
@@ -24,10 +25,10 @@ class UsernamePasswordToken extends AbstractToken
2425
private $providerKey;
2526

2627
/**
27-
* @param string|object $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method
28-
* @param mixed $credentials This usually is the password of the user
29-
* @param string $providerKey The provider key
30-
* @param (RoleInterface|string)[] $roles An array of roles
28+
* @param string|\Stringable|UserInterface $user The username (like a nickname, email address, etc.) or a UserInterface instance
29+
* @param mixed $credentials
30+
* @param string $providerKey
31+
* @param (Role|string)[] $roles
3132
*
3233
* @throws \InvalidArgumentException
3334
*/

0 commit comments

Comments
 (0)