diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f780b0..56a8f16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,9 +14,16 @@ jobs: matrix: php-versions: ['8.0', '8.1', '8.2', '8.3'] coverage: ['xdebug'] + code-style: ['yes'] code-analysis: ['no'] include: - php-versions: '7.4' + coverage: 'xdebug' + code-style: 'yes' + code-analysis: 'yes' + - php-versions: '8.4' + coverage: 'xdebug' + code-style: 'yes' code-analysis: 'yes' steps: - name: Checkout @@ -45,8 +52,8 @@ jobs: run: composer install --no-progress --prefer-dist --optimize-autoloader - name: Code Analysis (PHP CS-Fixer) - if: matrix.code-analysis == 'yes' - run: php vendor/bin/php-cs-fixer fix --dry-run --diff + if: matrix.code-style == 'yes' + run: PHP_CS_FIXER_IGNORE_ENV=true php vendor/bin/php-cs-fixer fix --dry-run --diff - name: Code Analysis (PHPStan) if: matrix.code-analysis == 'yes' diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index e981862..4d464eb 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -10,6 +10,10 @@ $config->setRules([ '@PSR1' => true, '@Symfony' => true, + 'nullable_type_declaration' => [ + 'syntax' => 'question_mark', + ], + 'nullable_type_declaration_for_default_null_value' => true, ]); return $config; diff --git a/composer.json b/composer.json index 8525426..98edcd7 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "sabre/uri" : "^2.3 || ^3.0" }, "require-dev" : { - "friendsofphp/php-cs-fixer": "^3.56", + "friendsofphp/php-cs-fixer": "^3.64", "phpstan/phpstan": "^1.11", "phpstan/phpstan-phpunit": "^1.4", "phpstan/phpstan-strict-rules": "^1.6", @@ -53,7 +53,7 @@ "phpstan analyse lib tests" ], "cs-fixer": [ - "php-cs-fixer fix" + "PHP_CS_FIXER_IGNORE_ENV=true php-cs-fixer fix" ], "phpunit": [ "phpunit --configuration tests/phpunit.xml" diff --git a/lib/Client.php b/lib/Client.php index 859ea09..72a6c09 100644 --- a/lib/Client.php +++ b/lib/Client.php @@ -474,7 +474,7 @@ protected function parseCurlResponse(array $headerLines, string $body, $curlHand list( $curlInfo, $curlErrNo, - $curlErrMsg + $curlErrMsg, ) = $this->curlStuff($curlHandle); if (0 !== $curlErrNo) { @@ -531,7 +531,7 @@ protected function parseCurlResult(string $response, $curlHandle): array list( $curlInfo, $curlErrNo, - $curlErrMsg + $curlErrMsg, ) = $this->curlStuff($curlHandle); if (0 !== $curlErrNo) { diff --git a/lib/Response.php b/lib/Response.php index c6d8b12..648d8e9 100644 --- a/lib/Response.php +++ b/lib/Response.php @@ -153,7 +153,7 @@ public function setStatus($status): void } else { list( $statusCode, - $statusText + $statusText, ) = explode(' ', $status, 2); } $statusCode = (int) $statusCode; diff --git a/phpstan.neon b/phpstan.neon index 2d08f5f..159a2af 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -14,6 +14,14 @@ parameters: message: "#^Left side of || is always false.$#" count: 6 path: lib/Client.php + - + message: "#^Else branch is unreachable because ternary operator condition is always true.$#" + count: 1 + path: lib/Auth/Digest.php + - + message: "#^Strict comparison using !== between '' and non-empty-string will always evaluate to true.$#" + count: 1 + path: lib/Auth/Digest.php - message: "#^Casting to string something that's already string.$#" count: 1 @@ -22,6 +30,10 @@ parameters: message: "#^Strict comparison using === between null and array will always evaluate to false.$#" count: 1 path: lib/functions.php + - + message: "#^Offset 'value' on array.* in isset\\(\\) always exists and is not nullable.$#" + count: 1 + path: lib/functions.php - message: "#^.* will always evaluate to true\\.$#" count: 4