Skip to content

Commit

Permalink
Merge pull request #126 from wp-cli/fix/wpcs-3.0-issues
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Aug 30, 2023
2 parents 962c420 + 7425292 commit ce08eda
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
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
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
Related: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1623 -->
<rule ref="WordPress.NamingConventions.ValidVariableName">
<properties>
<property name="customPropertiesWhitelist" type="array">
<property name="allowed_custom_properties" type="array">
<element value="Language"/>
<element value="Name"/>
<element value="Type"/>
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

0 comments on commit ce08eda

Please sign in to comment.