From c2ffea3353a366835a6c751bd9d281af82dd2d75 Mon Sep 17 00:00:00 2001 From: Evgeniy Zyubin Date: Mon, 27 May 2024 10:04:37 +0300 Subject: [PATCH 1/3] Add support of HTTP/3.0 --- src/MessageTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MessageTrait.php b/src/MessageTrait.php index d1c568f..decec2b 100644 --- a/src/MessageTrait.php +++ b/src/MessageTrait.php @@ -36,7 +36,7 @@ trait MessageTrait * * @var string[] */ - private static array $supportedProtocolVersions = ['1.0', '1.1', '2.0', '2']; + private static array $supportedProtocolVersions = ['1.0', '1.1', '2.0', '2', '3.0', '3']; /** * Map of all registered original headers, as `original header name` => `array of values`. From 7c4a4fd933097490a6d87f5221c172c9d33424da Mon Sep 17 00:00:00 2001 From: Evgeniy Zyubin Date: Mon, 27 May 2024 10:58:26 +0300 Subject: [PATCH 2/3] Fix static analysis --- src/RequestTrait.php | 5 +++-- src/ResponseTrait.php | 1 + src/StreamTrait.php | 2 ++ src/Uri.php | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/RequestTrait.php b/src/RequestTrait.php index 247920d..d4f4c25 100644 --- a/src/RequestTrait.php +++ b/src/RequestTrait.php @@ -131,7 +131,7 @@ public function getMethod(): string * @param string $method Case-sensitive method. * @return static * @throws InvalidArgumentException for invalid HTTP methods. - * @psalm-suppress DocblockTypeContradiction + * @psalm-suppress TypeDoesNotContainType, NoValue, RedundantCondition */ public function withMethod($method): RequestInterface { @@ -241,7 +241,7 @@ private function init( /** * @param UriInterface|string $uri * @throws InvalidArgumentException for invalid URI. - * @psalm-suppress RedundantConditionGivenDocblockType + * @psalm-suppress TypeDoesNotContainType, NoValue, RedundantCondition */ private function setUri($uri): void { @@ -265,6 +265,7 @@ private function setUri($uri): void * Updates `Host` header from the current URI and sets the `Host` first in the list of headers. * * @see https://tools.ietf.org/html/rfc7230#section-5.4 + * @psalm-suppress RiskyTruthyFalsyComparison */ private function updateHostHeaderFromUri(): void { diff --git a/src/ResponseTrait.php b/src/ResponseTrait.php index 6aaaf05..a8556c4 100644 --- a/src/ResponseTrait.php +++ b/src/ResponseTrait.php @@ -147,6 +147,7 @@ public function getStatusCode(): int * @psalm-suppress DocblockTypeContradiction * @psalm-suppress TypeDoesNotContainType * @psalm-suppress RedundantCondition + * @psalm-suppress InvalidCast * @psalm-suppress NoValue */ public function withStatus($code, $reasonPhrase = ''): ResponseInterface diff --git a/src/StreamTrait.php b/src/StreamTrait.php index 146c724..0dfb0e0 100644 --- a/src/StreamTrait.php +++ b/src/StreamTrait.php @@ -171,6 +171,7 @@ public function eof(): bool * Returns whether or not the stream is seekable. * * @return bool + * @psalm-suppress RiskyTruthyFalsyComparison */ public function isSeekable(): bool { @@ -363,6 +364,7 @@ public function getContents(): string * @return array|mixed|null Returns an associative array if no key is * provided. Returns a specific key value if a key is provided and the * value is found, or null if the key is not found. + * @psalm-suppress RiskyTruthyFalsyComparison */ public function getMetadata($key = null) { diff --git a/src/Uri.php b/src/Uri.php index 5d4dc0d..59f61d3 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -358,6 +358,7 @@ public function withFragment($fragment): UriInterface * @param string $scheme * @return string * @throws InvalidArgumentException for invalid or unsupported schemes. + * @psalm-suppress RiskyTruthyFalsyComparison */ private function normalizeScheme(string $scheme): string { From 20f5e56b72f8783e218a37e0c7b63e1a228e4868 Mon Sep 17 00:00:00 2001 From: Evgeniy Zyubin Date: Mon, 27 May 2024 11:03:09 +0300 Subject: [PATCH 3/3] Fix static analysis --- src/RequestTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RequestTrait.php b/src/RequestTrait.php index d4f4c25..bd34459 100644 --- a/src/RequestTrait.php +++ b/src/RequestTrait.php @@ -131,7 +131,7 @@ public function getMethod(): string * @param string $method Case-sensitive method. * @return static * @throws InvalidArgumentException for invalid HTTP methods. - * @psalm-suppress TypeDoesNotContainType, NoValue, RedundantCondition + * @psalm-suppress DocblockTypeContradiction, TypeDoesNotContainType, NoValue, RedundantCondition */ public function withMethod($method): RequestInterface {