public static function createFromArray(array
$date_parts,
$timezone = NULL,
$settings =
[]) { $date_parts =
static::
prepareArray($date_parts, TRUE
);
if (static::
checkArray($date_parts)) { // Even with validation, we can end up with a value that the
// DateTime class won't handle, like a year outside the range
// of -9999 to 9999, which will pass checkdate() but
// fail to construct a date object.
$iso_date =
static::
arrayToISO($date_parts);
return new static($iso_date,
$timezone,
$settings);
} else { throw new \
InvalidArgumentException('The array contains invalid values.'
);
} }