#2794 allowing `DateTimeImmutable` instances when converting in mutable date...

#2794 allowing `DateTimeImmutable` instances when converting in mutable date types - reverts unintentional BC break
parent 18269e56
......@@ -53,7 +53,7 @@ class DateTimeType extends Type
return $value;
}
if ($value instanceof \DateTime) {
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value->format($platform->getDateTimeFormatString());
}
......@@ -65,7 +65,7 @@ class DateTimeType extends Type
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null || $value instanceof \DateTime) {
if ($value === null || $value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value;
}
......
......@@ -71,7 +71,7 @@ class DateTimeTzType extends Type
return $value;
}
if ($value instanceof \DateTime) {
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value->format($platform->getDateTimeTzFormatString());
}
......@@ -83,7 +83,7 @@ class DateTimeTzType extends Type
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null || $value instanceof \DateTime) {
if ($value === null || $value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value;
}
......
......@@ -53,7 +53,7 @@ class DateType extends Type
return $value;
}
if ($value instanceof \DateTime) {
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value->format($platform->getDateFormatString());
}
......@@ -65,7 +65,7 @@ class DateType extends Type
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null || $value instanceof \DateTime) {
if ($value === null || $value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value;
}
......
......@@ -53,7 +53,7 @@ class TimeType extends Type
return $value;
}
if ($value instanceof \DateTime) {
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value->format($platform->getTimeFormatString());
}
......@@ -65,7 +65,7 @@ class TimeType extends Type
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
if ($value === null || $value instanceof \DateTime) {
if ($value === null || $value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
return $value;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment