minor #36057 [Validator] clarify stringable type annotations (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] clarify stringable type annotations

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

0ee97f23a6 [Validator] clarify stringable type annotations
This commit is contained in:
Nicolas Grekas 2020-03-13 11:26:47 +01:00
commit cbb9d01b6c
3 changed files with 21 additions and 21 deletions

View File

@ -32,22 +32,22 @@ class ConstraintViolation implements ConstraintViolationInterface
/** /**
* Creates a new constraint violation. * Creates a new constraint violation.
* *
* @param string $message The violation message * @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
* @param mixed $root The value originally passed to the * @param mixed $root The value originally passed to the
* validator * validator
* @param string $propertyPath The property path from the root * @param string $propertyPath The property path from the root
* value to the invalid value * value to the invalid value
* @param mixed $invalidValue The invalid value that caused this * @param mixed $invalidValue The invalid value that caused this
* 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 mixed $code The error code of the violation * @param mixed $code The error code of the violation
* @param Constraint|null $constraint The constraint whose validation * @param Constraint|null $constraint The constraint whose validation
* caused the violation * caused the violation
* @param mixed $cause The cause of the violation * @param mixed $cause The cause of the violation
*/ */
public function __construct($message, $messageTemplate, array $parameters, $root, $propertyPath, $invalidValue, $plural = null, $code = null, Constraint $constraint = null, $cause = null) public function __construct($message, $messageTemplate, array $parameters, $root, $propertyPath, $invalidValue, $plural = null, $code = null, Constraint $constraint = null, $cause = null)
{ {

View File

@ -36,7 +36,7 @@ interface ConstraintViolationInterface
/** /**
* Returns the violation message. * Returns the violation message.
* *
* @return string The violation message * @return string|\Stringable The violation message as a string or a stringable object
*/ */
public function getMessage(); public function getMessage();

View File

@ -64,8 +64,8 @@ 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 $message 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 * @param array $params The parameters substituted in the error message
*/ */
public function addViolation($message, array $params = []); public function addViolation($message, array $params = []);
@ -81,8 +81,8 @@ interface ExecutionContextInterface
* ->setTranslationDomain('number_validation') * ->setTranslationDomain('number_validation')
* ->addViolation(); * ->addViolation();
* *
* @param string $message 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 * @param array $parameters The parameters substituted in the error message
* *
* @return ConstraintViolationBuilderInterface The violation builder * @return ConstraintViolationBuilderInterface The violation builder
*/ */