From 3a8f10b5724402243feae3310662a8925f8e9f94 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 2 Jan 2024 14:51:01 +0100 Subject: [PATCH] fix the exception being thrown --- src/Symfony/Component/Validator/Constraints/JsonValidator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Constraints/JsonValidator.php b/src/Symfony/Component/Validator/Constraints/JsonValidator.php index 176331f6f0314..a2a26d574d909 100644 --- a/src/Symfony/Component/Validator/Constraints/JsonValidator.php +++ b/src/Symfony/Component/Validator/Constraints/JsonValidator.php @@ -14,6 +14,7 @@ use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; +use Symfony\Component\Validator\Exception\UnexpectedValueException; /** * @author Imad ZAIRIG @@ -34,7 +35,7 @@ public function validate($value, Constraint $constraint) } if (!\is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string'); + throw new UnexpectedValueException($value, 'string'); } $value = (string) $value;