Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a8f10b

Browse files
committed
fix the exception being thrown
1 parent d1126fd commit 3a8f10b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/Validator/Constraints/JsonValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Validator\Constraint;
1515
use Symfony\Component\Validator\ConstraintValidator;
1616
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
17+
use Symfony\Component\Validator\Exception\UnexpectedValueException;
1718

1819
/**
1920
* @author Imad ZAIRIG <[email protected]>
@@ -34,7 +35,7 @@ public function validate($value, Constraint $constraint)
3435
}
3536

3637
if (!\is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
37-
throw new UnexpectedTypeException($value, 'string');
38+
throw new UnexpectedValueException($value, 'string');
3839
}
3940

4041
$value = (string) $value;

0 commit comments

Comments
 (0)