19 declare(strict_types=1);
    44             PREG_UNMATCHED_AS_NULL
    48         yield 
from array_slice($matches, 1);
    53         $factors = [1, 12, 30, 24, 60, 60];
    57             $result = $factors[$factor_index] * $result + $number;
    72             PREG_UNMATCHED_AS_NULL
    76         yield 
from array_slice($matches, 1);
    85             PREG_UNMATCHED_AS_NULL
    87         return new \DateTimeImmutable(
    88             ($matches[1] ?? 
'0000') . 
'-' .
    89             ($matches[2] ?? 
'01') . 
'-' .
   102         $has_time = !is_null($hours) || !is_null($minutes) || !is_null($seconds);
   104         if (is_null($years) && is_null($months) && is_null($days) && !$has_time) {
   109         if (!is_null($years)) {
   110             $string .= max($years, 0) . 
'Y';
   112         if (!is_null($months)) {
   113             $string .= max($months, 0) . 
'M';
   115         if (!is_null($days)) {
   116             $string .= max($days, 0) . 
'D';
   123         if (!is_null($hours)) {
   124             $string .= max($hours, 0) . 
'H';
   126         if (!is_null($minutes)) {
   127             $string .= max($minutes, 0) . 
'M';
   129         if (!is_null($seconds)) {
   130             $string .= max($seconds, 0) . 
'S';
   138         return $object->format(
'Y-m-d');