From f8bd0ef0451976ab65b0e99a4412210555caeb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kon=C3=A1=C5=A1?= Date: Mon, 24 Jun 2024 07:37:00 +0200 Subject: [PATCH] Test with PHP 8.2 and 8.3, update phpstan/phpstan (#89) * Update PHPstan configuration * Fix failing tests * Add new PHP versions to tests --- .editorconfig | 3 +++ .github/workflows/tests.yml | 2 +- composer.json | 2 +- phpstan.neon | 3 ++- src/CorsMiddleware.php | 9 +++++++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index c683c6a..dd8a3ae 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,6 +9,9 @@ insert_final_newline = true [*.php] indent_size = 4 +[*.neon] +indent_size = 4 + [Makefile] indent_style = tab indent_size = 4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a5b15e4..ef0f946 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ["7.2", "7.3", "7.4", "8.0", "8.1"] + php-versions: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] dependency-versions: ["highest", "lowest"] runs-on: ${{ matrix.operating-system }} steps: diff --git a/composer.json b/composer.json index b3d4335..d241f55 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "equip/dispatch": "^2.0", "nyholm/psr7": "^1.5", "overtrue/phplint": "^3.0", - "phpstan/phpstan": "^1.8", + "phpstan/phpstan": "^1.11", "phpstan/phpstan-strict-rules": "^1.4", "phpunit/phpunit": "^8.5.30|^9.0", "rector/rector": "^0.14.0", diff --git a/phpstan.neon b/phpstan.neon index f18f7bf..4d211a0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,6 @@ parameters: - checkMissingIterableValueType: false treatPhpDocTypesAsCertain: false + ignoreErrors: + - identifier: missingType.iterableValue includes: - vendor/phpstan/phpstan-strict-rules/rules.neon diff --git a/src/CorsMiddleware.php b/src/CorsMiddleware.php index 066fcbd..fd362ae 100644 --- a/src/CorsMiddleware.php +++ b/src/CorsMiddleware.php @@ -291,6 +291,7 @@ private function fixHeaders(array $headers): array /** * Set allowed origin. + * @phpstan-ignore method.unused */ private function origin(array $origin): void { @@ -300,6 +301,7 @@ private function origin(array $origin): void /** * Set request methods to be allowed. * @param callable|array $methods. + * @phpstan-ignore method.unused */ private function methods($methods): void { @@ -316,6 +318,7 @@ private function methods($methods): void /** * Set headers to be allowed. + * @phpstan-ignore method.unused */ private function headersAllow(array $headers): void { @@ -324,6 +327,7 @@ private function headersAllow(array $headers): void /** * Set headers to be exposed. + * @phpstan-ignore method.unused */ private function headersExpose(array $headers): void { @@ -332,6 +336,7 @@ private function headersExpose(array $headers): void /** * Enable or disable cookies and authentication. + * @phpstan-ignore method.unused */ private function credentials(bool $credentials): void { @@ -340,6 +345,7 @@ private function credentials(bool $credentials): void /** * Set the server origin. + * @phpstan-ignore method.unused */ private function originServer(?string $origin): void { @@ -348,6 +354,7 @@ private function originServer(?string $origin): void /** * Set the cache time in seconds. + * @phpstan-ignore method.unused */ private function cache(int $cache): void { @@ -356,6 +363,7 @@ private function cache(int $cache): void /** * Set the error handler. + * @phpstan-ignore method.unused */ private function error(callable $error): void { @@ -368,6 +376,7 @@ private function error(callable $error): void /** * Set the PSR-3 logger. + * @phpstan-ignore method.unused */ private function logger(LoggerInterface $logger = null): void {