Skip to content

Commit 7a81a86

Browse files
authored
Update to WPCS v3 (#241)
* Update to wp-cli-tests v4 (which requires WPCS v3) * Fix all autofixable CS issues
1 parent 0852e36 commit 7a81a86

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"wp-cli/db-command": "^1.3 || ^2",
2121
"wp-cli/entity-command": "^1.3 || ^2",
2222
"wp-cli/extension-command": "^1.2 || ^2",
23-
"wp-cli/wp-cli-tests": "^3.2.7"
23+
"wp-cli/wp-cli-tests": "^4"
2424
},
2525
"config": {
2626
"process-timeout": 7200,

core-command.php

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

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

src/Core_Command.php

+12-9
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,14 @@ private function multisite_convert_( $assoc_args ) {
793793
}
794794

795795
// copied from populate_network()
796-
private static function create_initial_blog( $network_id, $blog_id, $domain, $path,
797-
$subdomain_install, $site_user ) {
796+
private static function create_initial_blog(
797+
$network_id,
798+
$blog_id,
799+
$domain,
800+
$path,
801+
$subdomain_install,
802+
$site_user
803+
) {
798804
global $wpdb, $current_site, $wp_rewrite;
799805

800806
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- This is meant to replace Core functionality.
@@ -1138,10 +1144,8 @@ public function update( $args, $assoc_args ) {
11381144
WP_CLI::success( 'WordPress is at the latest minor release.' );
11391145
return;
11401146
}
1141-
} else {
1142-
if ( ! empty( $from_api->updates ) ) {
1147+
} elseif ( ! empty( $from_api->updates ) ) {
11431148
list( $update ) = $from_api->updates;
1144-
}
11451149
}
11461150
} elseif ( Utils\wp_version_compare( $assoc_args['version'], '<' )
11471151
|| 'nightly' === $assoc_args['version']
@@ -1262,7 +1266,7 @@ public function update_db( $args, $assoc_args ) {
12621266
$total = 0;
12631267
$site_ids = [];
12641268
foreach ( $it as $blog ) {
1265-
$total++;
1269+
++$total;
12661270
$site_ids[] = $blog->site_id;
12671271
$url = $blog->domain . $blog->path;
12681272
$cmd = "--url={$url} core update-db";
@@ -1285,7 +1289,7 @@ public function update_db( $args, $assoc_args ) {
12851289
$message = "Database upgraded successfully on {$url}";
12861290
}
12871291
WP_CLI::log( $message );
1288-
$success++;
1292+
++$success;
12891293
} else {
12901294
WP_CLI::warning( "Database failed to upgrade on {$url}" );
12911295
}
@@ -1506,7 +1510,7 @@ private function cleanup_extra_files( $version_from, $version_to, $locale, $inse
15061510
if ( file_exists( ABSPATH . $file ) ) {
15071511
unlink( ABSPATH . $file );
15081512
WP_CLI::log( "File removed: {$file}" );
1509-
$count++;
1513+
++$count;
15101514
}
15111515
}
15121516

@@ -1562,5 +1566,4 @@ function () use ( $new_zip_file ) {
15621566
WP_CLI::error( 'ZipArchive failed to open ZIP file.' );
15631567
}
15641568
}
1565-
15661569
}

src/WP_CLI/Core/NonDestructiveCoreUpgrader.php

-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ public function unpack_package( $package, $delete_package = false ) {
1313
return parent::unpack_package( $package, $delete_package );
1414
}
1515
}
16-

0 commit comments

Comments
 (0)