#2794 simplifying date/time instance checking by comparing against `DateTimeInterface` instead

parent 7388a78c
......@@ -53,7 +53,7 @@ class DateTimeType extends Type
return $value;
}
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
if ($value instanceof \DateTimeInterface) {
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 || $value instanceof \DateTimeImmutable) {
if ($value === null || $value instanceof \DateTimeInterface) {
return $value;
}
......
......@@ -71,7 +71,7 @@ class DateTimeTzType extends Type
return $value;
}
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
if ($value instanceof \DateTimeInterface) {
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 || $value instanceof \DateTimeImmutable) {
if ($value === null || $value instanceof \DateTimeInterface) {
return $value;
}
......
......@@ -53,7 +53,7 @@ class DateType extends Type
return $value;
}
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
if ($value instanceof \DateTimeInterface) {
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 || $value instanceof \DateTimeImmutable) {
if ($value === null || $value instanceof \DateTimeInterface) {
return $value;
}
......
......@@ -53,7 +53,7 @@ class TimeType extends Type
return $value;
}
if ($value instanceof \DateTime || $value instanceof \DateTimeImmutable) {
if ($value instanceof \DateTimeInterface) {
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 || $value instanceof \DateTimeImmutable) {
if ($value === null || $value instanceof \DateTimeInterface) {
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