From 11665051bbd48dabeb4e840ed78ba7739f618995 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 4 Apr 2023 15:22:49 -0500 Subject: [PATCH] qa: updated Psalm baseline Fixed one type issue in a test where it was possible to expand types expected. All other reported issues are now due to type inference being less strict than the engine, leading us to perform validation to be correct, but Psalm complaining that the expected types would not require validation. Signed-off-by: Matthew Weier O'Phinney --- psalm-baseline.xml | 204 ++++++++++++++++++++++++-------------------- test/StreamTest.php | 2 +- 2 files changed, 112 insertions(+), 94 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 03cb33d2..2d5fc326 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + null|callable @@ -10,20 +10,20 @@ - $previous->getCode() - $previous->getCode() + getCode()]]> + getCode()]]> ! is_string($name) - ! is_string($stream) && ! is_resource($stream) + - $new->headerNames[$normalized] - $this->headerNames[strtolower($header)] - $this->headerNames[strtolower($header)] - $this->headerNames[strtolower($name)] + headerNames[$normalized]]]> + headerNames[strtolower($header)]]]> + headerNames[strtolower($header)]]]> + headerNames[strtolower($name)]]]> $headerNames @@ -48,8 +48,8 @@ $header - $new->headerNames - $new->headers + headerNames]]> + headers]]> gettype($version) @@ -67,12 +67,12 @@ $maxLength - $this->resource + resource]]> - $this->decoratedStream->getSize() + decoratedStream->getSize()]]> @@ -82,7 +82,7 @@ $protocolVersion $requestTarget $uri - self::getValueFromKey($serializedRequest, 'body') + $headers @@ -101,19 +101,16 @@ $version - $request->getHeaders() + getHeaders()]]> is_string($method) - - $requestTarget - - $this->uri->getPort() - $uri->getPort() + uri->getPort()]]> + getPort()]]> @@ -142,7 +139,7 @@ $protocolVersion $reasonPhrase $statusCode - self::getValueFromKey($serializedResponse, 'body') + $headers @@ -191,7 +188,7 @@ $version - $response->getHeaders() + getHeaders()]]> (int) $status @@ -209,7 +206,7 @@ - ! is_array($data) && ! is_object($data) && null !== $data + $attribute @@ -218,7 +215,7 @@ - $requestFilter(new ServerRequest( + + ))]]> - $headers['cookie'] + $headers @@ -259,15 +256,15 @@ $proxyCIDRList - list<non-empty-string> + ]]> $resource - $this->resource - $this->resource - $this->resource + resource]]> + resource]]> + resource]]> @@ -280,7 +277,7 @@ ! is_string($targetPath) - $this->file + file]]> @@ -289,33 +286,54 @@ - - ! is_numeric($port) - is_float($port) - is_object($port) - is_string($fragment) - is_string($host) - is_string($path) - is_string($query) - is_string($scheme) - is_string($user) - null !== $password && ! is_string($password) - $key $key $matches[0] $value + is_object($fragment) ? $fragment::class : gettype($fragment) + is_object($host) ? $host::class : gettype($host) + is_object($password) ? $password::class : gettype($password) + is_object($port) ? $port::class : gettype($port) + is_object($scheme) ? $scheme::class : gettype($scheme) + is_object($user) ? $user::class : gettype($user) - $this->port + port]]> - + (int) $port - - + + + gettype($fragment) + gettype($host) + gettype($password) gettype($port) - + gettype($scheme) + gettype($user) + + + ! is_numeric($port) + ! is_numeric($port) || is_float($port) + ! is_numeric($port) || is_float($port) + is_float($port) + is_object($fragment) + is_object($host) + is_object($password) + is_object($port) + is_object($scheme) + is_object($user) + is_string($fragment) + is_string($host) + is_string($path) + is_string($query) + is_string($scheme) + is_string($user) + + + + SensitiveParameter + @@ -324,10 +342,10 @@ - $spec['error'] - $spec['name'] ?? null - $spec['tmp_name'] - $spec['type'] ?? null + + + + @@ -352,8 +370,8 @@ string - $server['REQUEST_METHOD'] ?? 'GET' - $server['REQUEST_METHOD'] ?? 'GET' + + @@ -363,7 +381,7 @@ - $server['SERVER_PROTOCOL'] + @@ -383,14 +401,14 @@ static function (string $name, array $headers, $default = null) { - $getHeaderFromArray('x-forwarded-proto', $headers, '') + $host $host $host $host $port $requestUri - $server['QUERY_STRING'] + $headers[$header] @@ -407,7 +425,7 @@ string - $server['SERVER_ADDR'] + $defaults @@ -415,7 +433,7 @@ $unencodedUrl - strrpos($host, ':') + @@ -426,13 +444,13 @@ - $apacheRequestHeaders['Authorization'] - $apacheRequestHeaders['authorization'] + + $apacheRequestHeaders - $server['HTTP_AUTHORIZATION'] - $server['HTTP_AUTHORIZATION'] + + @@ -460,25 +478,25 @@ $nameTree[$key] ?? null, $typeTree[$key] ?? null ) - $recursiveNormalize( + + )]]> array - $recursiveNormalize( + + )]]> @@ -491,7 +509,7 @@ $cookies - array<non-empty-string, string> + ]]> @@ -502,7 +520,7 @@ - $stream->getSize() + getSize()]]> @@ -547,7 +565,7 @@ $responseCode - list<array{numeric-string, non-empty-string}> + ]]> assertIsInt @@ -558,7 +576,7 @@ - $normalizedFiles['fooFiles'] + @@ -587,23 +605,23 @@ - $normalised['my-form']['details']['avatars'] - $normalised['slide-shows'][0]['slides'] + + - $normalised['my-form']['details']['avatar'] - $normalised['my-form']['details']['avatars'] - $normalised['my-form']['details']['avatars'] - $normalised['my-form']['details']['avatars'] - $normalised['my-form']['details']['avatars'] - $normalised['my-form']['details']['avatars'][0] - $normalised['my-form']['details']['avatars'][1] - $normalised['my-form']['details']['avatars'][2] - $normalised['slide-shows'][0]['slides'] - $normalised['slide-shows'][0]['slides'] - $normalised['slide-shows'][0]['slides'] - $normalised['slide-shows'][0]['slides'][0] - $normalised['slide-shows'][0]['slides'][1] + + + + + + + + + + + + + getClientFilename @@ -614,14 +632,14 @@ getClientFilename - $normalised['my-form'] - $normalised['my-form'] - $normalised['my-form'] - $normalised['my-form'] - $normalised['my-form'] - $normalised['slide-shows'] - $normalised['slide-shows'] - $normalised['slide-shows'] + + + + + + + + diff --git a/test/StreamTest.php b/test/StreamTest.php index d2737c47..b63e7a41 100644 --- a/test/StreamTest.php +++ b/test/StreamTest.php @@ -637,7 +637,7 @@ public function testRaisesExceptionOnAttachForNonStreamResources(): void $stream->attach($resource); } - /** @return CurlHandle|GdImage|Shmop|false */ + /** @return CurlHandle|GdImage|Shmop|false|resource */ public function getResourceFor67() { if (function_exists('curl_init')) {