Skip to content

Commit

Permalink
WPCS 3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc45 committed Mar 13, 2024
1 parent 2cf2a34 commit 1c9df43
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/.phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<exclude name="Generic.Commenting.DocComment.MissingShort"/>

<!-- WPCS 3 -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/>
<exclude name="WordPress.Security.EscapeOutput.ExceptionNotEscaped"/>
<exclude name="Universal.ControlStructures.DisallowLonelyIf.Found"/>
<exclude name="Universal.Operators.DisallowShortTernary.Found"/>

<!-- Ignored until this is answered: https://github.com/squizlabs/PHP_CodeSniffer/issues/3570 -->
<exclude name="Squiz.Commenting.FunctionComment.Missing"/>

Expand Down
2 changes: 1 addition & 1 deletion src/src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/src/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( '<comment>Request failed... Waiting %d seconds and retrying (429 Too many Requests)</comment>', $sleep_seconds ) );

Expand All @@ -282,7 +282,7 @@ public function request(): string {
}
} else {
if ( $this->retry > 0 ) {
$this->retry --;
--$this->retry;
App::make( Output::class )->writeln( sprintf( '<comment>Request failed... Retrying (HTTP Status Code %s) %s</comment>', $response_status_code, $error_message ) );

// Between 1 and 5s.
Expand Down
2 changes: 1 addition & 1 deletion src/src/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down
2 changes: 1 addition & 1 deletion src/src/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 1c9df43

Please sign in to comment.