Skip to content

Commit 207559c

Browse files
committed
fix: Allow DateTimeInterface for DatetimeCast
1 parent 8c1b480 commit 207559c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

system/Entity/Cast/DatetimeCast.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace CodeIgniter\Entity\Cast;
1515

1616
use CodeIgniter\I18n\Time;
17-
use DateTime;
17+
use DateTimeInterface;
1818
use Exception;
1919

2020
class DatetimeCast extends BaseCast
@@ -32,7 +32,7 @@ public static function get($value, array $params = [])
3232
return $value;
3333
}
3434

35-
if ($value instanceof DateTime) {
35+
if ($value instanceof DateTimeInterface) {
3636
return Time::createFromInstance($value);
3737
}
3838

system/Entity/Entity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ protected function mapProperty(string $key)
534534
}
535535

536536
/**
537-
* Converts the given string|timestamp|DateTimeInterface|Time instance
537+
* Converts the given string|timestamp|DateTimeInterface instance
538538
* into the "CodeIgniter\I18n\Time" object.
539539
*
540-
* @param DateTimeInterface|float|int|string|Time $value
540+
* @param DateTimeInterface|float|int|string $value
541541
*
542542
* @return Time
543543
*

0 commit comments

Comments
 (0)