Merge branch '3.4' into 4.4
* 3.4: fix typo [Validator] clarify stringable type annotations [Security/Core] fix some annotations
This commit is contained in:
commit
162758317c
@ -31,7 +31,7 @@ abstract class AbstractToken implements TokenInterface
|
|||||||
private $attributes = [];
|
private $attributes = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string[] $roles An array of roles
|
* @param (Role|string)[] $roles An array of roles
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,7 @@ abstract class AbstractToken implements TokenInterface
|
|||||||
if (\is_string($role)) {
|
if (\is_string($role)) {
|
||||||
$role = new Role($role, false);
|
$role = new Role($role, false);
|
||||||
} elseif (!$role instanceof Role) {
|
} elseif (!$role instanceof Role) {
|
||||||
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or Role instances, but got %s.', \gettype($role)));
|
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings or Role instances, but got %s.', \gettype($role)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->roles[] = $role;
|
$this->roles[] = $role;
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Core\Authentication\Token;
|
namespace Symfony\Component\Security\Core\Authentication\Token;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AnonymousToken represents an anonymous token.
|
* AnonymousToken represents an anonymous token.
|
||||||
*
|
*
|
||||||
@ -22,8 +25,8 @@ class AnonymousToken extends AbstractToken
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $secret A secret used to make sure the token is created by the app and not by a malicious client
|
* @param string $secret A secret used to make sure the token is created by the app and not by a malicious client
|
||||||
* @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
|
* @param string|\Stringable|UserInterface $user
|
||||||
* @param string[] $roles An array of roles
|
* @param (Role|string)[] $roles
|
||||||
*/
|
*/
|
||||||
public function __construct(string $secret, $user, array $roles = [])
|
public function __construct(string $secret, $user, array $roles = [])
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Core\Authentication\Token;
|
namespace Symfony\Component\Security\Core\Authentication\Token;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PreAuthenticatedToken implements a pre-authenticated token.
|
* PreAuthenticatedToken implements a pre-authenticated token.
|
||||||
*
|
*
|
||||||
@ -22,10 +25,10 @@ class PreAuthenticatedToken extends AbstractToken
|
|||||||
private $providerKey;
|
private $providerKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
* @param string|\Stringable|UserInterface $user
|
||||||
* @param mixed $credentials The user credentials
|
* @param mixed $credentials
|
||||||
* @param string $providerKey The provider key
|
* @param string $providerKey
|
||||||
* @param string[] $roles An array of roles
|
* @param (Role|string)[] $roles
|
||||||
*/
|
*/
|
||||||
public function __construct($user, $credentials, string $providerKey, array $roles = [])
|
public function __construct($user, $credentials, string $providerKey, array $roles = [])
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\Security\Core\Authentication\Token;
|
namespace Symfony\Component\Security\Core\Authentication\Token;
|
||||||
|
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TokenInterface is the interface for the user authentication information.
|
* TokenInterface is the interface for the user authentication information.
|
||||||
@ -53,8 +54,7 @@ interface TokenInterface extends \Serializable
|
|||||||
/**
|
/**
|
||||||
* Returns a user representation.
|
* Returns a user representation.
|
||||||
*
|
*
|
||||||
* @return string|object Can be a UserInterface instance, an object implementing a __toString method,
|
* @return string|\Stringable|UserInterface
|
||||||
* or the username as a regular string
|
|
||||||
*
|
*
|
||||||
* @see AbstractToken::setUser()
|
* @see AbstractToken::setUser()
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ interface TokenInterface extends \Serializable
|
|||||||
* The user can be a UserInterface instance, or an object implementing
|
* The user can be a UserInterface instance, or an object implementing
|
||||||
* a __toString method or the username as a regular string.
|
* a __toString method or the username as a regular string.
|
||||||
*
|
*
|
||||||
* @param string|object $user The user
|
* @param string|\Stringable|UserInterface $user
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Security\Core\Authentication\Token;
|
namespace Symfony\Component\Security\Core\Authentication\Token;
|
||||||
|
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UsernamePasswordToken implements a username and password token.
|
* UsernamePasswordToken implements a username and password token.
|
||||||
*
|
*
|
||||||
@ -22,10 +25,10 @@ class UsernamePasswordToken extends AbstractToken
|
|||||||
private $providerKey;
|
private $providerKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|object $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method
|
* @param string|\Stringable|UserInterface $user The username (like a nickname, email address, etc.) or a UserInterface instance
|
||||||
* @param mixed $credentials This usually is the password of the user
|
* @param mixed $credentials
|
||||||
* @param string $providerKey The provider key
|
* @param string $providerKey
|
||||||
* @param string[] $roles An array of roles
|
* @param (Role|string)[] $roles
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,7 @@ class ConstraintViolation implements ConstraintViolationInterface
|
|||||||
/**
|
/**
|
||||||
* Creates a new constraint violation.
|
* Creates a new constraint violation.
|
||||||
*
|
*
|
||||||
* @param string|object $message The violation message as a string or a stringable object
|
* @param string|\Stringable $message The violation message as a string or a stringable object
|
||||||
* @param string $messageTemplate The raw violation message
|
* @param string $messageTemplate The raw violation message
|
||||||
* @param array $parameters The parameters to substitute in the
|
* @param array $parameters The parameters to substitute in the
|
||||||
* raw violation message
|
* raw violation message
|
||||||
@ -44,7 +44,9 @@ class ConstraintViolation implements ConstraintViolationInterface
|
|||||||
* violation
|
* violation
|
||||||
* @param int|null $plural The number for determining the plural
|
* @param int|null $plural The number for determining the plural
|
||||||
* form when translating the message
|
* form when translating the message
|
||||||
* @param string|null $code The error code of the violation
|
* @param mixed $code The error code of the violation
|
||||||
|
* @param Constraint|null $constraint The constraint whose validation
|
||||||
|
* caused the violation
|
||||||
* @param mixed $cause The cause of the violation
|
* @param mixed $cause The cause of the violation
|
||||||
*/
|
*/
|
||||||
public function __construct($message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, $code = null, Constraint $constraint = null, $cause = null)
|
public function __construct($message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, $code = null, Constraint $constraint = null, $cause = null)
|
||||||
|
@ -36,7 +36,7 @@ interface ConstraintViolationInterface
|
|||||||
/**
|
/**
|
||||||
* Returns the violation message.
|
* Returns the violation message.
|
||||||
*
|
*
|
||||||
* @return string|object The violation message as a string or a stringable object
|
* @return string|\Stringable The violation message as a string or a stringable object
|
||||||
*/
|
*/
|
||||||
public function getMessage();
|
public function getMessage();
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ interface ExecutionContextInterface
|
|||||||
/**
|
/**
|
||||||
* Adds a violation at the current node of the validation graph.
|
* Adds a violation at the current node of the validation graph.
|
||||||
*
|
*
|
||||||
* @param string|object $message The error message as a string or a stringable object
|
* @param string|\Stringable $message The error message as a string or a stringable object
|
||||||
* @param array $params The parameters substituted in the error message
|
* @param array $params The parameters substituted in the error message
|
||||||
*/
|
*/
|
||||||
public function addViolation($message, array $params = []);
|
public function addViolation($message, array $params = []);
|
||||||
@ -81,7 +81,7 @@ interface ExecutionContextInterface
|
|||||||
* ->setTranslationDomain('number_validation')
|
* ->setTranslationDomain('number_validation')
|
||||||
* ->addViolation();
|
* ->addViolation();
|
||||||
*
|
*
|
||||||
* @param string|object $message The error message as a string or a stringable object
|
* @param string|\Stringable $message The error message as a string or a stringable object
|
||||||
* @param array $parameters The parameters substituted in the error message
|
* @param array $parameters The parameters substituted in the error message
|
||||||
*
|
*
|
||||||
* @return ConstraintViolationBuilderInterface The violation builder
|
* @return ConstraintViolationBuilderInterface The violation builder
|
||||||
|
Reference in New Issue
Block a user