chore: Проверки для типов

This commit is contained in:
origami11@yandex.ru 2025-12-01 16:19:28 +03:00
parent 6fdc3eb46b
commit 5d3fae4249
15 changed files with 125 additions and 42 deletions

View file

@ -81,7 +81,7 @@ class Primitive {
if ($month != 0 && $day != 0 && $year != 0) {
if (checkdate($month, $day, $year)) {
return mktime(0, 0, 0, $month, $day, $year);
return mktime(0, 0, 0, $month, $day, $year) ?: 0;
} else {
return 0;
}
@ -102,7 +102,7 @@ class Primitive {
$tmp = [];
if (preg_match('/(\d+)-(\d+)-(\d+)T(\d+):(\d+)Z/', $value, $tmp)) {
if (checkdate((int)$tmp[2], (int)$tmp[3], (int)$tmp[1])) {
$result = mktime((int)$tmp[4], (int)$tmp[5], 0, (int)$tmp[2], (int)$tmp[3], (int)$tmp[1]);
$result = mktime((int)$tmp[4], (int)$tmp[5], 0, (int)$tmp[2], (int)$tmp[3], (int)$tmp[1]) ?: 0;
}
}
return $result;