Skip to content

Commit 88069c9

Browse files
committed
cr amends
1 parent d01b131 commit 88069c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Schema/Traits/Custom_Table_Query_Methods.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -945,14 +945,14 @@ public static function cast_value_based_on_type( string $type, $value ) {
945945
* @return array<null|string|int|float|bool|DateTimeInterface> The value as an array.
946946
*/
947947
private static function ensure_array( $value ): array {
948-
if ( null !== $value && ! is_int( $value ) && ! is_string( $value ) && ! is_float( $value ) && ! is_bool( $value ) && ! $value instanceof DateTimeInterface && ! is_array( $value ) ) {
948+
if ( is_object( $value ) && ! $value instanceof DateTimeInterface ) {
949949
throw new InvalidArgumentException( 'Value should be an integer, string, float, boolean, DateTimeInterface, or array.' );
950950
}
951951

952952
if ( is_array( $value ) && $value ) {
953-
foreach ( $value as $v ) {
953+
foreach ( $value as $key => $v ) {
954954
if ( null !== $v && ! is_int( $v ) && ! is_string( $v ) && ! is_float( $v ) && ! is_bool( $v ) && ! $v instanceof DateTimeInterface ) {
955-
throw new InvalidArgumentException( 'Offset of value should be an integer, string, float, boolean or DateTimeInterface.' );
955+
throw new InvalidArgumentException( "Array element with offset '{$key}' should be an integer, string, float, boolean or DateTimeInterface." );
956956
}
957957
}
958958
}

0 commit comments

Comments
 (0)