Skip to content

Commit fac34b3

Browse files
committed
Remaining type fixes
1 parent e847909 commit fac34b3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/DB_Command.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ public function export( $args, $assoc_args ) {
709709
}
710710
}
711711

712-
$escaped_command = \WP_CLI\Utils\esc_cmd( $command, $command_esc_args );
712+
$escaped_command = \WP_CLI\Utils\esc_cmd( $command, ...$command_esc_args );
713713

714714
// Remove parameters not needed for SQL run.
715715
unset( $assoc_args['porcelain'] );
@@ -1120,6 +1120,8 @@ public function size( $args, $assoc_args ) {
11201120
];
11211121
}
11221122

1123+
$size_format_display = '';
1124+
11231125
if ( ! empty( $size_format ) || $human_readable ) {
11241126
foreach ( $rows as $index => $row ) {
11251127
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- Backfilling WP native constants.
@@ -1209,7 +1211,7 @@ function ( $a, $b ) use ( $order, $orderby ) {
12091211
list( $first, $second ) = $orderby_array;
12101212

12111213
if ( 'size' === $orderby ) {
1212-
return $first['Bytes'] > $second['Bytes'];
1214+
return $first['Bytes'] > $second['Bytes'] ? 1 : -1;
12131215
}
12141216

12151217
return strcmp( $first['Name'], $second['Name'] );
@@ -1491,7 +1493,7 @@ public function search( $args, $assoc_args ) {
14911493
$esc_like_search = '%' . Utils\esc_like( $search ) . '%';
14921494
}
14931495

1494-
$encoding = null;
1496+
$encoding = false;
14951497
if ( 0 === strpos( $wpdb->charset, self::ENCODING_UTF8 ) ) {
14961498
$encoding = 'UTF-8';
14971499
}
@@ -1571,7 +1573,7 @@ public function search( $args, $assoc_args ) {
15711573
}
15721574
if ( $after_context ) {
15731575
$end_offset = $offset + strlen( $match );
1574-
$after = \cli\safe_substr( substr( $col_val, $end_offset ), 0, $after_context, false /*is_width*/, $col_encoding );
1576+
$after = (string) \cli\safe_substr( substr( $col_val, $end_offset ), 0, $after_context, false /*is_width*/, $col_encoding );
15751577
// To lessen context duplication in output, shorten the after context if it overlaps with the next match.
15761578
if ( $i + 1 < $match_cnt && $end_offset + strlen( $after ) > $matches[0][ $i + 1 ][1] ) {
15771579
$after = substr( $after, 0, $matches[0][ $i + 1 ][1] - $end_offset );

0 commit comments

Comments
 (0)