From 9ca8ef90516b4767c0fb7d198e8ac0007ca94886 Mon Sep 17 00:00:00 2001 From: "Kasper D. Foslund" Date: Fri, 4 Oct 2024 11:50:31 +0200 Subject: [PATCH] fix: php 82 datetime get last errors See https://www.php.net/manual/en/datetimeimmutable.getlasterrors.php for more info. --- src/Constraint/FormatConstraint.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Constraint/FormatConstraint.php b/src/Constraint/FormatConstraint.php index 35e5758..ec98de4 100644 --- a/src/Constraint/FormatConstraint.php +++ b/src/Constraint/FormatConstraint.php @@ -122,6 +122,10 @@ private function isDateTimeValid($date, $format) $errors = DateTime::getLastErrors(); + if (is_bool($errors)) { + return !$errors; + } + return $errors['warning_count'] === 0 && $errors['error_count'] === 0; } }