Skip to content

Commit 5a04465

Browse files
committed
Add support for DateTimeInterface objects
1 parent dc591ea commit 5a04465

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.2.6] - 2020-05-21
6+
### Changed
7+
- Add support for DateTimeImmutable objects
8+
59
## [2.2.5] - 2020-03-22
610
### Changed
711
- Add support for Laravel 7

src/Objects/Concerns/ReplacesBindings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Mnabialek\LaravelSqlLogger\Objects\Concerns;
44

5-
use DateTime;
5+
use DateTimeInterface;
66

77
trait ReplacesBindings
88
{
@@ -72,7 +72,7 @@ protected function getNamedParameterRegex($name)
7272
protected function formatBindings($bindings)
7373
{
7474
foreach ($bindings as $key => $binding) {
75-
if ($binding instanceof DateTime) {
75+
if ($binding instanceof DateTimeInterface) {
7676
$bindings[$key] = $binding->format('Y-m-d H:i:s');
7777
} elseif (is_string($binding)) {
7878
$bindings[$key] = str_replace("'", "\\'", $binding);

0 commit comments

Comments
 (0)