Skip to content

Commit

Permalink
Merge branch '5.0'
Browse files Browse the repository at this point in the history
* 5.0:
  [Security/Core] fix merge
  fix typo
  [Validator] clarify stringable type annotations
  [Security/Core] fix some annotations
  • Loading branch information
nicolas-grekas committed Mar 13, 2020
2 parents 14c95a9 + 2f94386 commit 5428fef
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 33 deletions.
Expand Up @@ -11,6 +11,8 @@

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

use Symfony\Component\Security\Core\User\UserInterface;

/**
* AnonymousToken represents an anonymous token.
*
Expand All @@ -21,9 +23,9 @@ class AnonymousToken extends AbstractToken
private $secret;

/**
* @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[] $roles An array of roles
* @param string $secret A secret used to make sure the token is created by the app and not by a malicious client
* @param string|\Stringable|UserInterface $user
* @param string[] $roles
*/
public function __construct(string $secret, $user, array $roles = [])
{
Expand Down
Expand Up @@ -11,6 +11,8 @@

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

use Symfony\Component\Security\Core\User\UserInterface;

/**
* PreAuthenticatedToken implements a pre-authenticated token.
*
Expand All @@ -22,10 +24,10 @@ class PreAuthenticatedToken extends AbstractToken
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 mixed $credentials The user credentials
* @param string $providerKey The provider key
* @param string[] $roles An array of roles
* @param string|\Stringable|UserInterface $user
* @param mixed $credentials
* @param string $providerKey
* @param string[] $roles
*/
public function __construct($user, $credentials, string $providerKey, array $roles = [])
{
Expand Down
Expand Up @@ -11,6 +11,8 @@

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

use Symfony\Component\Security\Core\User\UserInterface;

/**
* TokenInterface is the interface for the user authentication information.
*
Expand Down Expand Up @@ -45,8 +47,7 @@ public function getCredentials();
/**
* Returns a user representation.
*
* @return string|object Can be a UserInterface instance, an object implementing a __toString method,
* or the username as a regular string
* @return string|\Stringable|UserInterface
*
* @see AbstractToken::setUser()
*/
Expand All @@ -58,7 +59,7 @@ public function getUser();
* The user can be a UserInterface instance, or an object implementing
* a __toString method or the username as a regular string.
*
* @param string|object $user The user
* @param string|\Stringable|UserInterface $user
*
* @throws \InvalidArgumentException
*/
Expand Down
Expand Up @@ -11,6 +11,8 @@

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

use Symfony\Component\Security\Core\User\UserInterface;

/**
* UsernamePasswordToken implements a username and password token.
*
Expand All @@ -22,10 +24,10 @@ class UsernamePasswordToken extends AbstractToken
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 mixed $credentials This usually is the password of the user
* @param string $providerKey The provider key
* @param string[] $roles An array of roles
* @param string|\Stringable|UserInterface $user The username (like a nickname, email address, etc.) or a UserInterface instance
* @param mixed $credentials
* @param string $providerKey
* @param string[] $roles
*
* @throws \InvalidArgumentException
*/
Expand Down
30 changes: 16 additions & 14 deletions src/Symfony/Component/Validator/ConstraintViolation.php
Expand Up @@ -32,20 +32,22 @@ class ConstraintViolation implements ConstraintViolationInterface
/**
* Creates a new constraint violation.
*
* @param string|object $message The violation message as a string or a stringable object
* @param string $messageTemplate The raw violation message
* @param array $parameters The parameters to substitute in the
* raw violation message
* @param mixed $root The value originally passed to the
* validator
* @param string $propertyPath The property path from the root
* value to the invalid value
* @param mixed $invalidValue The invalid value that caused this
* violation
* @param int|null $plural The number for determining the plural
* form when translating the message
* @param string|null $code The error code of the violation
* @param mixed $cause The cause of the violation
* @param string|\Stringable $message The violation message as a string or a stringable object
* @param string $messageTemplate The raw violation message
* @param array $parameters The parameters to substitute in the
* raw violation message
* @param mixed $root The value originally passed to the
* validator
* @param string $propertyPath The property path from the root
* value to the invalid value
* @param mixed $invalidValue The invalid value that caused this
* violation
* @param int|null $plural The number for determining the plural
* form when translating the message
* @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
*/
public function __construct($message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, string $code = null, Constraint $constraint = null, $cause = null)
{
Expand Down
Expand Up @@ -36,7 +36,7 @@ interface ConstraintViolationInterface
/**
* 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();

Expand Down
Expand Up @@ -64,8 +64,8 @@ interface ExecutionContextInterface
/**
* 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 array $params The parameters substituted in the error message
* @param string|\Stringable $message The error message as a string or a stringable object
* @param array $params The parameters substituted in the error message
*/
public function addViolation(string $message, array $params = []);

Expand All @@ -81,8 +81,8 @@ public function addViolation(string $message, array $params = []);
* ->setTranslationDomain('number_validation')
* ->addViolation();
*
* @param string|object $message The error message as a string or a stringable object
* @param array $parameters The parameters substituted in the error message
* @param string|\Stringable $message The error message as a string or a stringable object
* @param array $parameters The parameters substituted in the error message
*
* @return ConstraintViolationBuilderInterface The violation builder
*/
Expand Down

0 comments on commit 5428fef

Please sign in to comment.