diff --git a/composer.json b/composer.json index 1efbf30236..fdae4727d2 100644 --- a/composer.json +++ b/composer.json @@ -77,7 +77,7 @@ "php-di/php-di": "^7.0", "phpat/phpat": "^0.11.0", "phpbench/phpbench": "^1.4", - "phpstan/phpstan": "2.1.40", + "phpstan/phpstan": "2.2.6", "phpunit/phpunit": "^12.5.22", "predis/predis": "^3.0.0", "riskio/oauth2-auth0": "^2.4", diff --git a/packages/console/src/Components/Option.php b/packages/console/src/Components/Option.php index d8f0780d5d..65d2dbbb0e 100644 --- a/packages/console/src/Components/Option.php +++ b/packages/console/src/Components/Option.php @@ -19,9 +19,7 @@ final class Option return $this->value; } - /** @phpstan-ignore-next-line */ if (method_exists($this->value, 'toString')) { - /** @phpstan-ignore-next-line */ return $this->value->toString(); } diff --git a/packages/container/src/GenericContainer.php b/packages/container/src/GenericContainer.php index 12e2538cc4..a28576b887 100644 --- a/packages/container/src/GenericContainer.php +++ b/packages/container/src/GenericContainer.php @@ -234,7 +234,7 @@ public function invoke(ClassReflector|MethodReflector|FunctionReflector|callable return $this->invokeClosure($method, ...$params); } - if (is_array($method) && count($method) === 2) { + if (is_array($method)) { return $this->invokeClosure($method(...), ...$params); } diff --git a/packages/cryptography/tests/Signing/SignerTest.php b/packages/cryptography/tests/Signing/SignerTest.php index eb70a22a6f..f17ac79c2d 100644 --- a/packages/cryptography/tests/Signing/SignerTest.php +++ b/packages/cryptography/tests/Signing/SignerTest.php @@ -87,7 +87,7 @@ public function test_no_signing_key(): void minimumExecutionDuration: false, )); - $signer->sign('important data'); + $signer->sign('important data'); // @phpstan-ignore method.resultUnused (call is expected to throw before returning) } public function test_empty_data(): void diff --git a/packages/discovery/src/BootDiscovery.php b/packages/discovery/src/BootDiscovery.php index de15cafca9..f013d9f2d4 100644 --- a/packages/discovery/src/BootDiscovery.php +++ b/packages/discovery/src/BootDiscovery.php @@ -288,7 +288,7 @@ private function resolveDiscovery(string $discoveryClass): Discovery if ($discovery === null) { try { $discovery = new $discoveryClass(); - } catch (ArgumentCountError) { // @phpstan-ignore catch.neverThrown + } catch (ArgumentCountError) { throw DiscoveryClassCouldNotBeResolved::forDiscoveryClass($discoveryClass); } } diff --git a/packages/http/src/Cookie/Cookie.php b/packages/http/src/Cookie/Cookie.php index 9d56219433..2c2db60d9a 100644 --- a/packages/http/src/Cookie/Cookie.php +++ b/packages/http/src/Cookie/Cookie.php @@ -123,13 +123,13 @@ public static function createFromString(string $string): self return new Cookie( key: $cookie['name'], - value: $cookie['value'] ?? null, + value: $cookie['value'], expiresAt: isset($cookie['expires']) ? (int) $cookie['expires'] : null, maxAge: isset($cookie['max-age']) ? (int) $cookie['max-age'] : null, domain: $cookie['domain'] ?? null, path: $cookie['path'] ?? '/', - secure: isset($cookie['secure']) && $cookie['secure'] === true, - httpOnly: isset($cookie['httponly']) && $cookie['httponly'] === true, + secure: isset($cookie['secure']), + httpOnly: isset($cookie['httponly']), sameSite: isset($cookie['samesite']) ? SameSite::from($cookie['samesite']) : null, ); } diff --git a/packages/view/src/Parser/TempestViewLexer.php b/packages/view/src/Parser/TempestViewLexer.php index 36750baaec..779e56da45 100644 --- a/packages/view/src/Parser/TempestViewLexer.php +++ b/packages/view/src/Parser/TempestViewLexer.php @@ -148,6 +148,7 @@ private function lexTag(): array ); if ($hasValue) { + // @phpstan-ignore identical.alwaysFalse (seek() is stateful; consume() above advanced past '=', so it now returns the quote char) $quote = $this->seek() === "'" ? "'" : '"';