diff --git a/composer.json b/composer.json index 1ba1f207b..df669a663 100644 --- a/composer.json +++ b/composer.json @@ -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, diff --git a/language-command.php b/language-command.php index 5153b90ea..02c0a5b77 100644 --- a/language-command.php +++ b/language-command.php @@ -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.' ); } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 6f1bc3e21..0dd741bd0 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -63,7 +63,7 @@ Related: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1623 --> - + diff --git a/src/Core_Language_Command.php b/src/Core_Language_Command.php index b6a6271b5..8430bc536 100644 --- a/src/Core_Language_Command.php +++ b/src/Core_Language_Command.php @@ -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'; @@ -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 ); @@ -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; } } diff --git a/src/Plugin_Language_Command.php b/src/Plugin_Language_Command.php index 681514ed7..2a59c59a9 100644 --- a/src/Plugin_Language_Command.php +++ b/src/Plugin_Language_Command.php @@ -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 ); @@ -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; } } } @@ -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 ); @@ -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; } } diff --git a/src/Theme_Language_Command.php b/src/Theme_Language_Command.php index 6765e2052..5bcdc6e69 100644 --- a/src/Theme_Language_Command.php +++ b/src/Theme_Language_Command.php @@ -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() ) @@ -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 ); @@ -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; } } } @@ -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 ); @@ -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; } } diff --git a/src/WP_CLI/CommandWithTranslation.php b/src/WP_CLI/CommandWithTranslation.php index a07dab0f7..1cfcdd331 100644 --- a/src/WP_CLI/CommandWithTranslation.php +++ b/src/WP_CLI/CommandWithTranslation.php @@ -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; };