Release 2.16 (#4780)

This commit is contained in:
Kevin Papst
2024-05-01 14:24:24 +02:00
committed by GitHub
parent 8f8d228fb3
commit 99c296a751
150 changed files with 2498 additions and 1905 deletions

View File

@@ -49,8 +49,6 @@ final class UTCDateTimeType extends DateTimeType
/**
* @param mixed $value
* @param AbstractPlatform $platform
* @return null|\DateTime
* @throws ConversionException
*/
public function convertToPHPValue($value, AbstractPlatform $platform): ?\DateTime
@@ -59,20 +57,22 @@ final class UTCDateTimeType extends DateTimeType
return $value;
}
$converted = \DateTime::createFromFormat(
$platform->getDateTimeFormatString(),
$value,
self::getUtc()
);
if (!$converted) {
throw ConversionException::conversionFailedFormat(
if (\is_string($value)) {
$converted = \DateTime::createFromFormat(
$platform->getDateTimeFormatString(),
$value,
Types::DATETIME_MUTABLE,
$platform->getDateTimeFormatString()
self::getUtc()
);
if ($converted !== false) {
return $converted;
}
}
return $converted;
throw ConversionException::conversionFailedFormat(
$value,
Types::DATETIME_MUTABLE,
$platform->getDateTimeFormatString()
);
}
}