Skip to content

Commit cc36bca

Browse files
Merge branch '3.4' into 4.4
* 3.4: fix typo [Validator] clarify stringable type annotations [Security/Core] fix some annotations
2 parents 3d2f1d6 + 5b87767 commit cc36bca

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
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 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, false);
4343
} elseif (!$role instanceof Role) {
44-
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or Role instances, but got %s.', \gettype($role)));
44+
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings or Role instances, but got %s.', \gettype($role)));
4545
}
4646

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

Authentication/Token/AnonymousToken.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

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

14+
use Symfony\Component\Security\Core\Role\Role;
15+
use Symfony\Component\Security\Core\User\UserInterface;
16+
1417
/**
1518
* AnonymousToken represents an anonymous token.
1619
*
@@ -21,9 +24,9 @@ class AnonymousToken extends AbstractToken
2124
private $secret;
2225

2326
/**
24-
* @param string $secret A secret used to make sure the token is created by the app and not by a malicious client
25-
* @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
26-
* @param string[] $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
2730
*/
2831
public function __construct(string $secret, $user, array $roles = [])
2932
{

Authentication/Token/PreAuthenticatedToken.php

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

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

14+
use Symfony\Component\Security\Core\Role\Role;
15+
use Symfony\Component\Security\Core\User\UserInterface;
16+
1417
/**
1518
* PreAuthenticatedToken implements a pre-authenticated token.
1619
*
@@ -22,10 +25,10 @@ class PreAuthenticatedToken extends AbstractToken
2225
private $providerKey;
2326

2427
/**
25-
* @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
26-
* @param mixed $credentials The user credentials
27-
* @param string $providerKey The provider key
28-
* @param 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
2932
*/
3033
public function __construct($user, $credentials, string $providerKey, array $roles = [])
3134
{

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\Role;
15+
use Symfony\Component\Security\Core\User\UserInterface;
1516

1617
/**
1718
* TokenInterface is the interface for the user authentication information.
@@ -53,8 +54,7 @@ public function getCredentials();
5354
/**
5455
* Returns a user representation.
5556
*
56-
* @return string|object Can be a UserInterface instance, an object implementing a __toString method,
57-
* or the username as a regular string
57+
* @return string|\Stringable|UserInterface
5858
*
5959
* @see AbstractToken::setUser()
6060
*/
@@ -66,7 +66,7 @@ public function getUser();
6666
* The user can be a UserInterface instance, or an object implementing
6767
* a __toString method or the username as a regular string.
6868
*
69-
* @param string|object $user The user
69+
* @param string|\Stringable|UserInterface $user
7070
*
7171
* @throws \InvalidArgumentException
7272
*/

Authentication/Token/UsernamePasswordToken.php

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

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

14+
use Symfony\Component\Security\Core\Role\Role;
15+
use Symfony\Component\Security\Core\User\UserInterface;
16+
1417
/**
1518
* UsernamePasswordToken implements a username and password token.
1619
*
@@ -22,10 +25,10 @@ class UsernamePasswordToken extends AbstractToken
2225
private $providerKey;
2326

2427
/**
25-
* @param string|object $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method
26-
* @param mixed $credentials This usually is the password of the user
27-
* @param string $providerKey The provider key
28-
* @param 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
2932
*
3033
* @throws \InvalidArgumentException
3134
*/

0 commit comments

Comments
 (0)