From 0ee97f23a6711ff302686549a876ae6831192a6c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 13 Mar 2020 11:25:23 +0100 Subject: [PATCH] [Validator] clarify stringable type annotations --- .../Validator/ConstraintViolation.php | 32 +++++++++---------- .../ConstraintViolationInterface.php | 2 +- .../Context/ExecutionContextInterface.php | 8 ++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Symfony/Component/Validator/ConstraintViolation.php b/src/Symfony/Component/Validator/ConstraintViolation.php index ae9ff89eb5..a90a7a0bd8 100644 --- a/src/Symfony/Component/Validator/ConstraintViolation.php +++ b/src/Symfony/Component/Validator/ConstraintViolation.php @@ -32,22 +32,22 @@ class ConstraintViolation implements ConstraintViolationInterface /** * Creates a new constraint violation. * - * @param string $message The violation message - * @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 + * @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, $messageTemplate, array $parameters, $root, $propertyPath, $invalidValue, $plural = null, $code = null, Constraint $constraint = null, $cause = null) { diff --git a/src/Symfony/Component/Validator/ConstraintViolationInterface.php b/src/Symfony/Component/Validator/ConstraintViolationInterface.php index 5ac25cf9ba..137d7015bf 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationInterface.php +++ b/src/Symfony/Component/Validator/ConstraintViolationInterface.php @@ -36,7 +36,7 @@ interface ConstraintViolationInterface /** * 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(); diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php index 09137f8511..3d7925b471 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php @@ -64,8 +64,8 @@ interface ExecutionContextInterface /** * Adds a violation at the current node of the validation graph. * - * @param string $message The error message - * @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($message, array $params = []); @@ -81,8 +81,8 @@ interface ExecutionContextInterface * ->setTranslationDomain('number_validation') * ->addViolation(); * - * @param string $message The error message - * @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 */