Skip to content

Commit df59e77

Browse files
Fix checking result of DateTime::getLastErrors
1 parent 06db9bf commit df59e77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Constraints/DateTimeValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function validate($value, Constraint $constraint)
4848

4949
\DateTime::createFromFormat($constraint->format, $value);
5050

51-
$errors = \DateTime::getLastErrors();
51+
$errors = \DateTime::getLastErrors() ?: ['error_count' => 0, 'warnings' => []];
5252

5353
if (0 < $errors['error_count']) {
5454
$this->context->buildViolation($constraint->message)

0 commit comments

Comments
 (0)