Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to WPCS v3 #126

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"wp-cli/db-command": "^1.3 || ^2",
"wp-cli/entity-command": "^1.3 || ^2",
"wp-cli/extension-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^3.1"
"wp-cli/wp-cli-tests": "^4"
},
"config": {
"process-timeout": 7200,
Expand Down
4 changes: 2 additions & 2 deletions language-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
return;
}

$wpcli_language_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
$wpcli_language_autoloader = __DIR__ . '/vendor/autoload.php';

if ( file_exists( $wpcli_language_autoloader ) ) {
require_once $wpcli_language_autoloader;
}

$wpcli_language_check_requirements = function() {
$wpcli_language_check_requirements = function () {
if ( \WP_CLI\Utils\wp_version_compare( '4.0', '<' ) ) {
WP_CLI::error( 'Requires WordPress 4.0 or greater.' );
}
Expand Down
10 changes: 5 additions & 5 deletions src/Core_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function list_( $args, $assoc_args ) {
$current_locale = get_locale();

$translations = array_map(
function( $translation ) use ( $available, $current_locale, $updates ) {
function ( $translation ) use ( $available, $current_locale, $updates ) {
$translation['status'] = 'uninstalled';
if ( in_array( $translation['language'], $available, true ) ) {
$translation['status'] = 'installed';
Expand Down Expand Up @@ -199,7 +199,7 @@ public function install( $args, $assoc_args ) {

if ( in_array( $language_code, $available, true ) ) {
\WP_CLI::log( "Language '{$language_code}' already installed." );
$skips++;
++$skips;
} else {
$response = $this->download_language_pack( $language_code );

Expand All @@ -209,13 +209,13 @@ public function install( $args, $assoc_args ) {

// Skip if translation is not yet available.
if ( 'not_found' === $response->get_error_code() ) {
$skips++;
++$skips;
} else {
$errors++;
++$errors;
}
} else {
\WP_CLI::log( "Language '{$language_code}' installed." );
$successes++;
++$successes;
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/Plugin_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private function install_one( $args, $assoc_args ) {

if ( in_array( $language_code, $available, true ) ) {
\WP_CLI::log( "Language '{$language_code}' already installed." );
$skips++;
++$skips;
} else {
$response = $this->download_language_pack( $language_code, $plugin );

Expand All @@ -273,13 +273,13 @@ private function install_one( $args, $assoc_args ) {

// Skip if translation is not yet available.
if ( 'not_found' === $response->get_error_code() ) {
$skips++;
++$skips;
} else {
$errors++;
++$errors;
}
} else {
\WP_CLI::log( "Language '{$language_code}' installed." );
$successes++;
++$successes;
}
}
}
Expand Down Expand Up @@ -332,7 +332,7 @@ private function install_many( $args, $assoc_args ) {
if ( in_array( $language_code, $available, true ) ) {
\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' already installed." );
$result['status'] = 'already installed';
$skips++;
++$skips;
} else {
$response = $this->download_language_pack( $language_code, $plugin_name );

Expand All @@ -342,15 +342,15 @@ private function install_many( $args, $assoc_args ) {

if ( 'not_found' === $response->get_error_code() ) {
$result['status'] = 'not available';
$skips++;
++$skips;
} else {
$result['status'] = 'not installed';
$errors++;
++$errors;
}
} else {
\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' installed." );
$result['status'] = 'installed';
$successes++;
++$successes;
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/Theme_Language_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function list_( $args, $assoc_args ) {

if ( $all ) {
$args = array_map(
function( $file ) {
function ( $file ) {
return \WP_CLI\Utils\get_theme_name( $file );
},
array_keys( wp_get_themes() )
Expand Down Expand Up @@ -269,7 +269,7 @@ private function install_one( $args, $assoc_args ) {

if ( in_array( $language_code, $available, true ) ) {
\WP_CLI::log( "Language '{$language_code}' already installed." );
$skips++;
++$skips;
} else {
$response = $this->download_language_pack( $language_code, $theme );

Expand All @@ -279,13 +279,13 @@ private function install_one( $args, $assoc_args ) {

// Skip if translation is not yet available.
if ( 'not_found' === $response->get_error_code() ) {
$skips++;
++$skips;
} else {
$errors++;
++$errors;
}
} else {
\WP_CLI::log( "Language '{$language_code}' installed." );
$successes++;
++$successes;
}
}
}
Expand Down Expand Up @@ -338,7 +338,7 @@ private function install_many( $args, $assoc_args ) {
if ( in_array( $language_code, $available, true ) ) {
\WP_CLI::log( "Language '{$language_code}' for '{$theme_details['Name']}' already installed." );
$result['status'] = 'already installed';
$skips++;
++$skips;
} else {
$response = $this->download_language_pack( $language_code, $theme_name );

Expand All @@ -348,15 +348,15 @@ private function install_many( $args, $assoc_args ) {

if ( 'not_found' === $response->get_error_code() ) {
$result['status'] = 'not available';
$skips++;
++$skips;
} else {
$result['status'] = 'not installed';
$errors++;
++$errors;
}
} else {
\WP_CLI::log( "Language '{$language_code}' for '{$theme_details['Name']}' installed." );
$result['status'] = 'installed';
$successes++;
++$successes;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/WP_CLI/CommandWithTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function update( $args, $assoc_args ) {
protected function get_translation_updates() {
$available = $this->get_installed_languages();

$func = function() use ( $available ) {
$func = function () use ( $available ) {
return $available;
};

Expand Down