From 3a7ffcc9b59976d5db2e81298837a6a7814570b2 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 24 Apr 2026 11:37:56 +0100 Subject: [PATCH] Chore: Upgrade PHPStan to 2.x Bumps phpstan/phpstan from 1.* to ^2.0 and fixes the 3 errors surfaced at level 5: - curl_setopt CURLOPT_RETURNTRANSFER value uses bool instead of int - drop redundant assertIsArray/assertIsInt on already-typed returns Co-Authored-By: Claude Opus 4.7 (1M context) --- composer.json | 2 +- composer.lock | 18 +++++++++--------- tests/RequestTest.php | 2 -- tests/e2e/Client.php | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 81e71451..9d61da57 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "require-dev": { "doctrine/instantiator": "^1.5", "laravel/pint": "1.*", - "phpstan/phpstan": "1.*", + "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^9.5.25", "swoole/ide-helper": "4.8.3" } diff --git a/composer.lock b/composer.lock index ca5e428f..3cd8052a 100644 --- a/composer.lock +++ b/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": "5e8f23d1b6e3a46861f6cc37eef30e4a", + "content-hash": "7d61467ab074538162535159ae1da884", "packages": [ { "name": "brick/math", @@ -2496,15 +2496,15 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.33", + "version": "2.1.51", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/37982d6fc7cbb746dda7773530cda557cdf119e1", - "reference": "37982d6fc7cbb746dda7773530cda557cdf119e1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc3b523c45e714c70de2ac5113b958223b55dc59", + "reference": "dc3b523c45e714c70de2ac5113b958223b55dc59", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -2545,7 +2545,7 @@ "type": "github" } ], - "time": "2026-02-28T20:30:03+00:00" + "time": "2026-04-21T18:22:01+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4083,17 +4083,17 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=8.2" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "8.2", "ext-opentelemetry": "1.0.0", "ext-protobuf": "4.26.1" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/tests/RequestTest.php b/tests/RequestTest.php index 02d8930a..7f6ef982 100755 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -28,7 +28,6 @@ public function testCanGetHeaders() $this->assertEquals('value2', $this->request->getHeader('custom-new')); $headers = $this->request->getHeaders(); - $this->assertIsArray($headers); $this->assertCount(2, $headers); $this->assertEquals('value1', $headers['custom']); $this->assertEquals('value2', $headers['custom-new']); @@ -329,7 +328,6 @@ public function testCanGetSizeWithArrayHeaders() $size = $this->request->getSize(); - $this->assertIsInt($size); $this->assertGreaterThan(0, $size); } } diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 42fdd5a8..3e00db1c 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -64,7 +64,7 @@ public function call(string $method, string $path = '', array $headers = [], arr $cookies = []; curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);