Skip to content

Commit 9cbaace

Browse files
committed
another type safe fix
1 parent d984aee commit 9cbaace

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Schema/Traits/Custom_Table_Query_Methods.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,10 @@ public static function cast_value_based_on_type( string $type, $value ) {
802802
case Column::PHP_TYPE_JSON:
803803
return is_string( $value ) ? (array) json_decode( $value, true ) : (array) $value;
804804
case Column::PHP_TYPE_DATETIME:
805+
if ( $value instanceof DateTimeInterface ) {
806+
return $value;
807+
}
808+
805809
try {
806810
$instance = Config::get_container()->get( DateTimeInterface::class );
807811
} catch ( Exception $e ) {

0 commit comments

Comments
 (0)