Skip to content

Commit

Permalink
Update to WPCS v3 (#240)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
schlessera and danielbachhuber authored Aug 30, 2023
1 parent 3d488a9 commit 0908bf5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"require-dev": {
"wp-cli/entity-command": "^1.3 || ^2",
"wp-cli/wp-cli-tests": "^3.1"
"wp-cli/wp-cli-tests": "^4"
},
"config": {
"process-timeout": 7200,
Expand Down
2 changes: 1 addition & 1 deletion db-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
return;
}

$wpcli_db_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
$wpcli_db_autoloader = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $wpcli_db_autoloader ) ) {
require_once $wpcli_db_autoloader;
}
Expand Down
8 changes: 3 additions & 5 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ public function size( $args, $assoc_args ) {
if ( $orderby ) {
usort(
$rows,
function( $a, $b ) use ( $order, $orderby ) {
function ( $a, $b ) use ( $order, $orderby ) {

$orderby_array = 'asc' === $order ? array( $a, $b ) : array( $b, $a );
list( $first, $second ) = $orderby_array;
Expand Down Expand Up @@ -1373,11 +1373,9 @@ public function search( $args, $assoc_args ) {
if ( ! $text_columns ) {
if ( $stats ) {
$skipped[] = $table;
} else {
// Don't bother warning for term relationships (which is just 3 int columns).
if ( ! preg_match( '/_term_relationships$/', $table ) ) {
WP_CLI::warning( $primary_keys ? "No text columns for table '$table' - skipped." : "No primary key or text columns for table '$table' - skipped." );
}
} elseif ( ! preg_match( '/_term_relationships$/', $table ) ) {
WP_CLI::warning( $primary_keys ? "No text columns for table '$table' - skipped." : "No primary key or text columns for table '$table' - skipped." );
}
continue;
}
Expand Down

0 comments on commit 0908bf5

Please sign in to comment.