diff --git a/src/Symfony/Component/Validator/ConstraintViolation.php b/src/Symfony/Component/Validator/ConstraintViolation.php index aea02356ff..d5fe5fe658 100644 --- a/src/Symfony/Component/Validator/ConstraintViolation.php +++ b/src/Symfony/Component/Validator/ConstraintViolation.php @@ -32,20 +32,20 @@ class ConstraintViolation implements ConstraintViolationInterface /** * Creates a new constraint violation. * - * @param string $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 + * @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 + * @param mixed $root The value originally passed to the * validator - * @param string $propertyPath The property path from the root + * @param string $propertyPath The property path from the root * value to the invalid value - * @param mixed $invalidValue The invalid value that caused this + * @param mixed $invalidValue The invalid value that caused this * 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 - * @param string|null $code The error code of the violation - * @param mixed $cause The cause of the violation + * @param string|null $code The error code 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) { diff --git a/src/Symfony/Component/Validator/ConstraintViolationInterface.php b/src/Symfony/Component/Validator/ConstraintViolationInterface.php index 5875d37e25..524ca896d4 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 as a string or a stringable object + * @return string|object 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 05ca27b3f4..a98ede706d 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 as a string or a stringable object - * @param array $params The parameters substituted in the error message + * @param string|object $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 as a string or a stringable object - * @param array $parameters The parameters substituted in the error message + * @param string|object $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 */ diff --git a/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php b/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php index 1d4e4da367..053448e3c1 100644 --- a/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php +++ b/src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php @@ -128,7 +128,7 @@ Root.property.path: toString EOF; $this->assertSame($expected, (string) $violation); - $this->assertSame((string) $message, $violation->getMessage()); + $this->assertSame($message, $violation->getMessage()); } public function testMessageCannotBeArray() diff --git a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php index 0c2a6b4bd5..8d5b49b33b 100644 --- a/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php +++ b/src/Symfony/Component/Validator/Violation/ConstraintViolationBuilder.php @@ -45,7 +45,7 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface private $cause; /** - * @param string $message The error message as a string or a stringable object + * @param string|object $message The error message as a string or a stringable object * @param TranslatorInterface $translator */ public function __construct(ConstraintViolationList $violations, Constraint $constraint, $message, array $parameters, $root, string $propertyPath, $invalidValue, $translator, string $translationDomain = null)