allow empty strings as time format

This commit is contained in:
Kevin Papst
2020-08-18 15:03:46 +02:00
parent 9597015413
commit 367a901207
2 changed files with 9 additions and 2 deletions

View File

@@ -26,6 +26,10 @@ class TimeFormatValidator extends ConstraintValidator
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\TimeFormat');
}
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}