From 537078b3f4db07d9b09ff2191e3d45288f6dcccb Mon Sep 17 00:00:00 2001 From: Rasmus Date: Tue, 19 Jun 2018 13:17:12 +0200 Subject: [PATCH] Change DateTime detection to DateTimeInterface Allows for both DateTime and DateTimeImmutable --- src/Connection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index 979b93e..1f6d1f3 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -5,7 +5,7 @@ use Database\Query\Grammars\Grammar; use PDO; use Closure; -use DateTime; +use DateTimeInterface; use Psr\Log\LoggerAwareTrait; use Psr\Log\LoggerInterface; @@ -380,7 +380,7 @@ public function prepareBindings(array $bindings) // We need to transform all instances of the DateTime class into an actual // date string. Each query grammar maintains its own date string format // so we'll just ask the grammar for the format to get from the date. - if ($value instanceof DateTime) { + if ($value instanceof DateTimeInterface) { $bindings[$key] = $value->format($grammar->getDateFormat()); } elseif ($value === false) { $bindings[$key] = 0;