Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Commit

Permalink
PHP 8.2 Compatibility DateTime::getLastErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilETaylor authored and fabpot committed Sep 5, 2022
1 parent b27b8d6 commit 00f08ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Request/ParamConverter/DateTimeParamConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public function apply(Request $request, ParamConverter $configuration)
if (isset($options['format'])) {
$date = $class::createFromFormat($options['format'], $value);

if (0 < \DateTime::getLastErrors()['warning_count']) {
$errors = \DateTime::getLastErrors() ?: ['warning_count' => 0];

if (0 < $errors['warning_count']) {
$date = false;
}

Expand Down

0 comments on commit 00f08ea

Please sign in to comment.