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/composer.json b/src/composer.json index 677f2dd5..3f1be742 100644 --- a/src/composer.json +++ b/src/composer.json @@ -8,6 +8,8 @@ "dealerdirect/phpcodesniffer-composer-installer": true } }, + "minimum-stability": "dev", + "prefer-stable": true, "autoload": { "psr-4": { "QIT_CLI\\": "src/" @@ -31,7 +33,7 @@ "phpunit/phpunit": "^8", "phpstan/phpstan": "^1", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", - "wp-coding-standards/wpcs": "^2.3", + "wp-coding-standards/wpcs": "dev-develop", "phpcompatibility/php-compatibility": "^9", "spatie/phpunit-snapshot-assertions": "^3.0" } diff --git a/src/composer.lock b/src/composer.lock index 89d66494..7968a120 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "729ef0ce9177257c185be1e95a2947a1", + "content-hash": "ab3469eac95dc1902cd8d2199bd5c855", "packages": [ { "name": "composer/ca-bundle", @@ -1419,18 +1419,184 @@ }, "time": "2019-12-27T09:44:58+00:00" }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T16:49:07+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "908247bc65010c7b7541a9551e002db12e9dae70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/908247bc65010c7b7541a9551e002db12e9dae70", + "reference": "908247bc65010c7b7541a9551e002db12e9dae70", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.8.0 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T14:50:00+00:00" + }, { "name": "phpstan/phpstan", - "version": "1.10.59", + "version": "1.10.62", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e607609388d3a6d418a50a49f7940e8086798281" + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", - "reference": "e607609388d3a6d418a50a49f7940e8086798281", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd5c8a1660ed3540b211407c77abf4af193a6af9", + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9", "shasum": "" }, "require": { @@ -1479,7 +1645,7 @@ "type": "tidelift" } ], - "time": "2024-02-20T13:59:13+00:00" + "time": "2024-03-13T12:27:20+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2499,6 +2665,7 @@ "type": "github" } ], + "abandoned": true, "time": "2024-03-01T13:59:09+00:00" }, { @@ -2865,31 +3032,40 @@ }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "dev-develop", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "8b1a52e046668b7dcea1c3c663c5521b4b1c2a9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/8b1a52e046668b7dcea1c3c663c5521b4b1c2a9a", + "reference": "8b1a52e046668b7dcea1c3c663c5521b4b1c2a9a", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.2.1", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, + "default-branch": true, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2905,6 +3081,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -2912,13 +3089,21 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "time": "2024-03-05T10:47:01+00:00" } ], "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, + "minimum-stability": "dev", + "stability-flags": { + "wp-coding-standards/wpcs": 20 + }, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^7.2.5 | ^8", 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..74790aca 100644 --- a/src/src/RequestBuilder.php +++ b/src/src/RequestBuilder.php @@ -254,7 +254,7 @@ public function request(): string { curl_close( $curl ); if ( ! in_array( $response_status_code, $this->expected_status_codes, true ) ) { - if ( $proxied && $body === false ) { + if ( $proxied && $result === false ) { $body = sprintf( 'Is the Automattic Proxy running and accessible through %s?', Config::get_proxy_url() ); } @@ -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 );