diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index 1866cd7a8e3..a1f284e6d33 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -463,7 +463,7 @@ public static function time($check) * * @param string|\DateTime $check a date string or object (will always pass) * @param string $type Parser type, one out of 'date', 'time', and 'datetime' - * @param string|int $format any format accepted by IntlDateFormatter + * @param string|int|null $format any format accepted by IntlDateFormatter * @return bool Success * @throws \InvalidArgumentException when unsupported $type given * @see \Cake\I18N\Time::parseDate(), \Cake\I18N\Time::parseTime(), \Cake\I18N\Time::parseDateTime() @@ -481,7 +481,7 @@ public static function localizedTime($check, $type = 'datetime', $format = null) if (empty($methods[$type])) { throw new \InvalidArgumentException('Unsupported parser type given.'); } - return (!is_null(Time::{$methods[$type]}($check, $format))); + return (Time::{$methods[$type]}($check, $format) !== null); } /**