Skip to content

Commit 0908bf5

Browse files
Update to WPCS v3 (#240)
* Update to wp-cli-tests v4 (which requires WPCS v3) * Fix all autofixable CS issues * Avoid nested control structure * Fix linting issue --------- Co-authored-by: Daniel Bachhuber <[email protected]>
1 parent 3d488a9 commit 0908bf5

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"require-dev": {
1818
"wp-cli/entity-command": "^1.3 || ^2",
19-
"wp-cli/wp-cli-tests": "^3.1"
19+
"wp-cli/wp-cli-tests": "^4"
2020
},
2121
"config": {
2222
"process-timeout": 7200,

db-command.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
return;
55
}
66

7-
$wpcli_db_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
7+
$wpcli_db_autoloader = __DIR__ . '/vendor/autoload.php';
88
if ( file_exists( $wpcli_db_autoloader ) ) {
99
require_once $wpcli_db_autoloader;
1010
}

src/DB_Command.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ public function size( $args, $assoc_args ) {
11141114
if ( $orderby ) {
11151115
usort(
11161116
$rows,
1117-
function( $a, $b ) use ( $order, $orderby ) {
1117+
function ( $a, $b ) use ( $order, $orderby ) {
11181118

11191119
$orderby_array = 'asc' === $order ? array( $a, $b ) : array( $b, $a );
11201120
list( $first, $second ) = $orderby_array;
@@ -1373,11 +1373,9 @@ public function search( $args, $assoc_args ) {
13731373
if ( ! $text_columns ) {
13741374
if ( $stats ) {
13751375
$skipped[] = $table;
1376-
} else {
13771376
// Don't bother warning for term relationships (which is just 3 int columns).
1378-
if ( ! preg_match( '/_term_relationships$/', $table ) ) {
1379-
WP_CLI::warning( $primary_keys ? "No text columns for table '$table' - skipped." : "No primary key or text columns for table '$table' - skipped." );
1380-
}
1377+
} elseif ( ! preg_match( '/_term_relationships$/', $table ) ) {
1378+
WP_CLI::warning( $primary_keys ? "No text columns for table '$table' - skipped." : "No primary key or text columns for table '$table' - skipped." );
13811379
}
13821380
continue;
13831381
}

0 commit comments

Comments
 (0)