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

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix the exception being thrown
  • Loading branch information
xabbuh committed Jan 2, 2024
commit 3a8f10b5724402243feae3310662a8925f8e9f94
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Expand All @@ -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;
Expand Down