diff --git a/WP_CLI_CS/ruleset.xml b/WP_CLI_CS/ruleset.xml index 1d9cf9ed4..b04b28a6c 100644 --- a/WP_CLI_CS/ruleset.xml +++ b/WP_CLI_CS/ruleset.xml @@ -73,10 +73,17 @@ - + - + + + + + + + + diff --git a/composer.json b/composer.json index 451a30f30..9566eb9c5 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "wp-cli/core-command": "^1 || ^2", "wp-cli/eval-command": "^1 || ^2", "wp-cli/wp-cli": "^2.5.1", - "wp-coding-standards/wpcs": "^2.3.0", + "wp-coding-standards/wpcs": "^3", "yoast/phpunit-polyfills": "^1.0.3" }, "require-dev": { diff --git a/src/Context/FeatureContext.php b/src/Context/FeatureContext.php index 9d87e2296..fab618e65 100644 --- a/src/Context/FeatureContext.php +++ b/src/Context/FeatureContext.php @@ -1061,7 +1061,7 @@ private static function log_run_times_after_scenario( $scope ) { $scenario_key = self::get_scenario_key( $scope ); if ( $scenario_key ) { self::$scenario_run_times[ $scenario_key ] += microtime( true ); - self::$scenario_count++; + ++self::$scenario_count; if ( count( self::$scenario_run_times ) > self::$num_top_scenarios ) { arsort( self::$scenario_run_times ); array_pop( self::$scenario_run_times ); @@ -1094,11 +1094,9 @@ private static function dir_diff_copy( $upd_dir, $src_dir, $cop_dir ) { throw new RuntimeException( sprintf( "Failed to create copy directory '%s': %s. " . __FILE__ . ':' . __LINE__, $cop_file, $error['message'] ) ); } self::copy_dir( $upd_file, $cop_file ); - } else { - if ( ! copy( $upd_file, $cop_file ) ) { + } elseif ( ! copy( $upd_file, $cop_file ) ) { $error = error_get_last(); throw new RuntimeException( sprintf( "Failed to copy '%s' to '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_file, $cop_file, $error['message'] ) ); - } } } elseif ( is_dir( $upd_file ) ) { self::dir_diff_copy( $upd_file, $src_file, $cop_file ); @@ -1229,10 +1227,11 @@ private static function log_proc_method_run_time( $key, $start_time ) { self::$proc_method_run_times[ $key ] = [ 0, 0 ]; } self::$proc_method_run_times[ $key ][0] += $run_time; - self::$proc_method_run_times[ $key ][1]++; + ++self::$proc_method_run_times[ $key ][1]; } } +// phpcs:ignore Universal.Files.SeparateFunctionsFromOO.Mixed function wp_cli_behat_env_debug( $message ) { if ( ! getenv( 'WP_CLI_TEST_DEBUG_BEHAT_ENV' ) ) { return; @@ -1301,7 +1300,6 @@ function wpcli_bootstrap_behat_feature_context() { wp_cli_behat_env_debug( "Project config file location: {$project_config}" ); wp_cli_behat_env_debug( "Project config:\n{$contents}" ); - } wpcli_bootstrap_behat_feature_context(); diff --git a/src/Context/Support.php b/src/Context/Support.php index 3e310a443..6c9f3dd76 100644 --- a/src/Context/Support.php +++ b/src/Context/Support.php @@ -25,14 +25,14 @@ protected function assert_not_regex( $regex, $actual ) { } protected function assert_equals( $expected, $actual ) { - // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Deliberate loose comparison. + // phpcs:ignore Universal.Operators.StrictComparisons.LooseNotEqual -- Deliberate loose comparison. if ( $expected != $actual ) { throw new Exception( 'Actual value: ' . var_export( $actual, true ) ); } } protected function assert_not_equals( $expected, $actual ) { - // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Deliberate loose comparison. + // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual -- Deliberate loose comparison. if ( $expected == $actual ) { throw new Exception( 'Actual value: ' . var_export( $actual, true ) ); } @@ -200,7 +200,7 @@ protected function check_that_csv_string_contains_values( $actual_csv, $expected ); if ( $actual_row === $expected_row ) { - $expected_result++; + ++$expected_result; } } } diff --git a/src/Context/WhenStepDefinitions.php b/src/Context/WhenStepDefinitions.php index 42f430eb6..a727e8c7f 100644 --- a/src/Context/WhenStepDefinitions.php +++ b/src/Context/WhenStepDefinitions.php @@ -62,4 +62,3 @@ public function when_i_run_the_previous_command_again( $mode ) { list( $this->result->stdout, $this->email_sends ) = $this->wpcli_tests_capture_email_sends( $this->result->stdout ); } } - diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9cf26389d..73b760328 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -59,4 +59,3 @@ function wpcli_tests_include_config( array $config_filenames = [] ) { '.phpunit.xml.dist', ] ); -