From 1c9df43ff9a2bdd11bf8f621512db7250054211d Mon Sep 17 00:00:00 2001 From: Lucas Bustamante Date: Wed, 13 Mar 2024 12:38:24 -0300 Subject: [PATCH] WPCS 3 changes --- src/.phpcs.xml.dist | 6 ++++++ src/src/Cache.php | 2 +- src/src/RequestBuilder.php | 4 ++-- src/src/Upload.php | 2 +- src/src/bootstrap.php | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/.phpcs.xml.dist b/src/.phpcs.xml.dist index 15c25f02..c3d819c4 100644 --- a/src/.phpcs.xml.dist +++ b/src/.phpcs.xml.dist @@ -55,6 +55,12 @@ + + + + + + diff --git a/src/src/Cache.php b/src/src/Cache.php index 5c1cbdb0..6092bd70 100644 --- a/src/src/Cache.php +++ b/src/src/Cache.php @@ -72,7 +72,7 @@ public function get( string $key, bool $ignore_expiration = false ) { } if ( $ignore_expiration === false && time() > $c['expire'] ) { - $deleted ++; + ++$deleted; unset( $this->cache[ $k ] ); } } diff --git a/src/src/RequestBuilder.php b/src/src/RequestBuilder.php index 5483e79f..cd31e269 100644 --- a/src/src/RequestBuilder.php +++ b/src/src/RequestBuilder.php @@ -273,7 +273,7 @@ public function request(): string { if ( $response_status_code === 429 ) { if ( $this->retry_429 > 0 ) { - $this->retry_429 --; + --$this->retry_429; $sleep_seconds = $this->wait_after_429( $headers ); App::make( Output::class )->writeln( sprintf( 'Request failed... Waiting %d seconds and retrying (429 Too many Requests)', $sleep_seconds ) ); @@ -282,7 +282,7 @@ public function request(): string { } } else { if ( $this->retry > 0 ) { - $this->retry --; + --$this->retry; App::make( Output::class )->writeln( sprintf( 'Request failed... Retrying (HTTP Status Code %s) %s', $response_status_code, $error_message ) ); // Between 1 and 5s. diff --git a/src/src/Upload.php b/src/src/Upload.php index aad15b2f..5794fa85 100644 --- a/src/src/Upload.php +++ b/src/src/Upload.php @@ -51,7 +51,7 @@ public function upload_build( int $woo_extension_id, string $extension_slug, str $progress_bar->start(); while ( ! feof( $file ) ) { - $current_chunk ++; + ++$current_chunk; $r = $this->request_builder ->with_url( get_manager_url() . '/wp-json/cd/v1/upload-build' ) diff --git a/src/src/bootstrap.php b/src/src/bootstrap.php index a812bfc9..24ef4069 100644 --- a/src/src/bootstrap.php +++ b/src/src/bootstrap.php @@ -81,7 +81,7 @@ public function getDefaultCommands() { if ( in_array( '--json', $GLOBALS['argv'], true ) ) { class QIT_JSON_Filter extends \php_user_filter { public function filter( $in, $out, &$consumed, $closing ): int { - while ( $bucket = stream_bucket_make_writeable( $in ) ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition + while ( $bucket = stream_bucket_make_writeable( $in ) ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition,Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition if ( ! is_null( json_decode( $bucket->data ) ) ) { $consumed += $bucket->datalen; stream_bucket_append( $out, $bucket );