Skip to content

Commit 6671a07

Browse files
committed
PHPCS: fix up the code base [3] - strict comparisons
Fixes relate to the following rules: * Use strict comparisons. * Use the `$strict` parameter when calling `in_array()`.
1 parent 1a1bd5c commit 6671a07

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Search_Replace_Command.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public function __invoke( $args, $assoc_args ) {
302302

303303
foreach ( $tables as $table ) {
304304

305-
if ( in_array( $table, $this->skip_tables ) ) {
305+
if ( in_array( $table, $this->skip_tables, true ) ) {
306306
continue;
307307
}
308308

@@ -340,11 +340,11 @@ public function __invoke( $args, $assoc_args ) {
340340
}
341341

342342
foreach ( $columns as $col ) {
343-
if ( ! empty( $this->include_columns ) && ! in_array( $col, $this->include_columns ) ) {
343+
if ( ! empty( $this->include_columns ) && ! in_array( $col, $this->include_columns, true ) ) {
344344
continue;
345345
}
346346

347-
if ( in_array( $col, $this->skip_columns ) ) {
347+
if ( in_array( $col, $this->skip_columns, true ) ) {
348348
continue;
349349
}
350350

@@ -438,7 +438,7 @@ private function php_export_table( $table, $old, $new ) {
438438
$row_fields = array();
439439
foreach ( $all_columns as $col ) {
440440
$value = $row->$col;
441-
if ( $value && ! in_array( $col, $primary_keys ) && ! in_array( $col, $this->skip_columns ) ) {
441+
if ( $value && ! in_array( $col, $primary_keys, true ) && ! in_array( $col, $this->skip_columns, true ) ) {
442442
$new_value = $replacer->run( $value );
443443
if ( $new_value !== $value ) {
444444
$col_counts[ $col ]++;
@@ -595,7 +595,7 @@ private function write_sql_row_fields( $table, $rows ) {
595595
// $index % $export_insert_size == 0 && $index > 0
596596
// 2. Or when the loop is running last time
597597
// $index == $count
598-
if ( ( $index % $export_insert_size == 0 && $index > 0 ) || $index == $count ) {
598+
if ( ( $index % $export_insert_size === 0 && $index > 0 ) || $index === $count ) {
599599
$sql .= ";\n";
600600

601601
if ( method_exists( $wpdb, 'remove_placeholder_escape' ) ) {

src/WP_CLI/SearchReplacer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private function _run( $data, $serialised, $recursion_level = 0, $visited_data =
6868
if ( $this->recurse_objects ) {
6969

7070
// If we've reached the maximum recursion level, short circuit
71-
if ( $this->max_recursion != 0 && $recursion_level >= $this->max_recursion ) {
71+
if ( $this->max_recursion !== 0 && $recursion_level >= $this->max_recursion ) {
7272
return $data;
7373
}
7474

0 commit comments

Comments
 (0)