Skip to content

Commit 5e37fec

Browse files
Seldaekstaabm
authored andcommitted
Allow serializing DateTime objects (partial impl from staabm#339)
1 parent e972564 commit 5e37fec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/QueryReflection/QuerySimulation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public static function simulateParamValueType(Type $paramType, bool $preparedPar
7373
return null;
7474
}
7575

76+
if ($paramType instanceof ObjectType && $paramType->isInstanceOf(\DateTimeInterface::class)) {
77+
return date(self::DATE_FORMAT, 0);
78+
}
79+
7680
$stringType = new StringType();
7781
$isStringableObjectType = $paramType instanceof ObjectType
7882
&& $paramType->isInstanceOf(Stringable::class)->yes();

0 commit comments

Comments
 (0)