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 @@ <?xml version="1.0" encoding="UTF-8"?> -<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5"> +<files psalm-version="5.9.0@8b9ad1eb9e8b7d3101f949291da2b9f7767cd163"> <file src="src/CallbackStream.php"> <ImplementedReturnTypeMismatch> <code>null|callable</code> @@ -10,20 +10,20 @@ </file> <file src="src/Exception/DeserializationException.php"> <PossiblyInvalidArgument> - <code>$previous->getCode()</code> - <code>$previous->getCode()</code> + <code><![CDATA[$previous->getCode()]]></code> + <code><![CDATA[$previous->getCode()]]></code> </PossiblyInvalidArgument> </file> <file src="src/MessageTrait.php"> <DocblockTypeContradiction> <code>! is_string($name)</code> - <code>! is_string($stream) && ! is_resource($stream)</code> + <code><![CDATA[! is_string($stream) && ! is_resource($stream)]]></code> </DocblockTypeContradiction> <InvalidArrayOffset> - <code>$new->headerNames[$normalized]</code> - <code>$this->headerNames[strtolower($header)]</code> - <code>$this->headerNames[strtolower($header)]</code> - <code>$this->headerNames[strtolower($name)]</code> + <code><![CDATA[$new->headerNames[$normalized]]]></code> + <code><![CDATA[$this->headerNames[strtolower($header)]]]></code> + <code><![CDATA[$this->headerNames[strtolower($header)]]]></code> + <code><![CDATA[$this->headerNames[strtolower($name)]]]></code> </InvalidArrayOffset> <InvalidPropertyAssignmentValue> <code>$headerNames</code> @@ -48,8 +48,8 @@ <code>$header</code> </ParamNameMismatch> <PropertyTypeCoercion> - <code>$new->headerNames</code> - <code>$new->headers</code> + <code><![CDATA[$new->headerNames]]></code> + <code><![CDATA[$new->headers]]></code> </PropertyTypeCoercion> <RedundantCondition> <code>gettype($version)</code> @@ -67,12 +67,12 @@ <code>$maxLength</code> </MixedArgument> <PossiblyNullArgument> - <code>$this->resource</code> + <code><![CDATA[$this->resource]]></code> </PossiblyNullArgument> </file> <file src="src/RelativeStream.php"> <PossiblyNullOperand> - <code>$this->decoratedStream->getSize()</code> + <code><![CDATA[$this->decoratedStream->getSize()]]></code> </PossiblyNullOperand> </file> <file src="src/Request/ArraySerializer.php"> @@ -82,7 +82,7 @@ <code>$protocolVersion</code> <code>$requestTarget</code> <code>$uri</code> - <code>self::getValueFromKey($serializedRequest, 'body')</code> + <code><![CDATA[self::getValueFromKey($serializedRequest, 'body')]]></code> </MixedArgument> <MixedAssignment> <code>$headers</code> @@ -101,19 +101,16 @@ <code>$version</code> </MixedArgument> <MixedArgumentTypeCoercion> - <code>$request->getHeaders()</code> + <code><![CDATA[$request->getHeaders()]]></code> </MixedArgumentTypeCoercion> </file> <file src="src/RequestTrait.php"> <DocblockTypeContradiction> <code>is_string($method)</code> </DocblockTypeContradiction> - <MoreSpecificImplementedParamType> - <code>$requestTarget</code> - </MoreSpecificImplementedParamType> <PossiblyNullOperand> - <code>$this->uri->getPort()</code> - <code>$uri->getPort()</code> + <code><![CDATA[$this->uri->getPort()]]></code> + <code><![CDATA[$uri->getPort()]]></code> </PossiblyNullOperand> </file> <file src="src/Response.php"> @@ -142,7 +139,7 @@ <code>$protocolVersion</code> <code>$reasonPhrase</code> <code>$statusCode</code> - <code>self::getValueFromKey($serializedResponse, 'body')</code> + <code><![CDATA[self::getValueFromKey($serializedResponse, 'body')]]></code> </MixedArgument> <MixedAssignment> <code>$headers</code> @@ -191,7 +188,7 @@ <code>$version</code> </MixedArgument> <MixedArgumentTypeCoercion> - <code>$response->getHeaders()</code> + <code><![CDATA[$response->getHeaders()]]></code> </MixedArgumentTypeCoercion> <RedundantCast> <code>(int) $status</code> @@ -209,7 +206,7 @@ </file> <file src="src/ServerRequest.php"> <DocblockTypeContradiction> - <code>! is_array($data) && ! is_object($data) && null !== $data</code> + <code><![CDATA[! is_array($data) && ! is_object($data) && null !== $data]]></code> </DocblockTypeContradiction> <ParamNameMismatch> <code>$attribute</code> @@ -218,7 +215,7 @@ </file> <file src="src/ServerRequestFactory.php"> <LessSpecificReturnStatement> - <code>$requestFilter(new ServerRequest( + <code><![CDATA[$requestFilter(new ServerRequest( $server, $files, UriFactory::createFromSapi($server, $headers), @@ -229,10 +226,10 @@ $query ?: $_GET, $body ?: $_POST, marshalProtocolVersionFromSapi($server) - ))</code> + ))]]></code> </LessSpecificReturnStatement> <MixedArgument> - <code>$headers['cookie']</code> + <code><![CDATA[$headers['cookie']]]></code> </MixedArgument> <MixedArgumentTypeCoercion> <code>$headers</code> @@ -259,15 +256,15 @@ <code>$proxyCIDRList</code> </LessSpecificReturnStatement> <MoreSpecificReturnType> - <code>list<non-empty-string></code> + <code><![CDATA[list<non-empty-string>]]></code> </MoreSpecificReturnType> </file> <file src="src/Stream.php"> <PossiblyNullArgument> <code>$resource</code> - <code>$this->resource</code> - <code>$this->resource</code> - <code>$this->resource</code> + <code><![CDATA[$this->resource]]></code> + <code><![CDATA[$this->resource]]></code> + <code><![CDATA[$this->resource]]></code> </PossiblyNullArgument> </file> <file src="src/StreamFactory.php"> @@ -280,7 +277,7 @@ <code>! is_string($targetPath)</code> </DocblockTypeContradiction> <PossiblyNullArgument> - <code>$this->file</code> + <code><![CDATA[$this->file]]></code> </PossiblyNullArgument> </file> <file src="src/UploadedFileFactory.php"> @@ -289,33 +286,54 @@ </PossiblyNullArgument> </file> <file src="src/Uri.php"> - <DocblockTypeContradiction> - <code>! is_numeric($port)</code> - <code>is_float($port)</code> - <code>is_object($port)</code> - <code>is_string($fragment)</code> - <code>is_string($host)</code> - <code>is_string($path)</code> - <code>is_string($query)</code> - <code>is_string($scheme)</code> - <code>is_string($user)</code> - <code>null !== $password && ! is_string($password)</code> - </DocblockTypeContradiction> <MixedArgument> <code>$key</code> <code>$key</code> <code>$matches[0]</code> <code>$value</code> + <code>is_object($fragment) ? $fragment::class : gettype($fragment)</code> + <code>is_object($host) ? $host::class : gettype($host)</code> + <code>is_object($password) ? $password::class : gettype($password)</code> + <code>is_object($port) ? $port::class : gettype($port)</code> + <code>is_object($scheme) ? $scheme::class : gettype($scheme)</code> + <code>is_object($user) ? $user::class : gettype($user)</code> </MixedArgument> <PossiblyNullOperand> - <code>$this->port</code> + <code><![CDATA[$this->port]]></code> </PossiblyNullOperand> - <RedundantCastGivenDocblockType> + <RedundantCast> <code>(int) $port</code> - </RedundantCastGivenDocblockType> - <RedundantConditionGivenDocblockType> + </RedundantCast> + <RedundantCondition> + <code>gettype($fragment)</code> + <code>gettype($host)</code> + <code>gettype($password)</code> <code>gettype($port)</code> - </RedundantConditionGivenDocblockType> + <code>gettype($scheme)</code> + <code>gettype($user)</code> + </RedundantCondition> + <TypeDoesNotContainType> + <code>! is_numeric($port)</code> + <code>! is_numeric($port) || is_float($port)</code> + <code>! is_numeric($port) || is_float($port)</code> + <code>is_float($port)</code> + <code>is_object($fragment)</code> + <code>is_object($host)</code> + <code>is_object($password)</code> + <code>is_object($port)</code> + <code>is_object($scheme)</code> + <code>is_object($user)</code> + <code>is_string($fragment)</code> + <code>is_string($host)</code> + <code>is_string($path)</code> + <code>is_string($query)</code> + <code>is_string($scheme)</code> + <code>is_string($user)</code> + <code><![CDATA[null !== $password && ! is_string($password)]]></code> + </TypeDoesNotContainType> + <UndefinedAttributeClass> + <code>SensitiveParameter</code> + </UndefinedAttributeClass> </file> <file src="src/functions/create_uploaded_file.legacy.php"> <MixedArgument> @@ -324,10 +342,10 @@ </file> <file src="src/functions/create_uploaded_file.php"> <MixedArgument> - <code>$spec['error']</code> - <code>$spec['name'] ?? null</code> - <code>$spec['tmp_name']</code> - <code>$spec['type'] ?? null</code> + <code><![CDATA[$spec['error']]]></code> + <code><![CDATA[$spec['name'] ?? null]]></code> + <code><![CDATA[$spec['tmp_name']]]></code> + <code><![CDATA[$spec['type'] ?? null]]></code> </MixedArgument> </file> <file src="src/functions/marshal_headers_from_sapi.legacy.php"> @@ -352,8 +370,8 @@ <code>string</code> </MixedInferredReturnType> <MixedReturnStatement> - <code>$server['REQUEST_METHOD'] ?? 'GET'</code> - <code>$server['REQUEST_METHOD'] ?? 'GET'</code> + <code><![CDATA[$server['REQUEST_METHOD'] ?? 'GET']]></code> + <code><![CDATA[$server['REQUEST_METHOD'] ?? 'GET']]></code> </MixedReturnStatement> </file> <file src="src/functions/marshal_protocol_version_from_sapi.legacy.php"> @@ -363,7 +381,7 @@ </file> <file src="src/functions/marshal_protocol_version_from_sapi.php"> <MixedArgument> - <code>$server['SERVER_PROTOCOL']</code> + <code><![CDATA[$server['SERVER_PROTOCOL']]]></code> </MixedArgument> </file> <file src="src/functions/marshal_uri_from_sapi.legacy.php"> @@ -383,14 +401,14 @@ <code>static function (string $name, array $headers, $default = null) {</code> </MissingClosureReturnType> <MixedArgument> - <code>$getHeaderFromArray('x-forwarded-proto', $headers, '')</code> + <code><![CDATA[$getHeaderFromArray('x-forwarded-proto', $headers, '')]]></code> <code>$host</code> <code>$host</code> <code>$host</code> <code>$host</code> <code>$port</code> <code>$requestUri</code> - <code>$server['QUERY_STRING']</code> + <code><![CDATA[$server['QUERY_STRING']]]></code> </MixedArgument> <MixedArgumentTypeCoercion> <code>$headers[$header]</code> @@ -407,7 +425,7 @@ <code>string</code> </MixedInferredReturnType> <MixedOperand> - <code>$server['SERVER_ADDR']</code> + <code><![CDATA[$server['SERVER_ADDR']]]></code> </MixedOperand> <MixedReturnStatement> <code>$defaults</code> @@ -415,7 +433,7 @@ <code>$unencodedUrl</code> </MixedReturnStatement> <PossiblyFalseOperand> - <code>strrpos($host, ':')</code> + <code><![CDATA[strrpos($host, ':')]]></code> </PossiblyFalseOperand> </file> <file src="src/functions/normalize_server.legacy.php"> @@ -426,13 +444,13 @@ </file> <file src="src/functions/normalize_server.php"> <MixedArrayAccess> - <code>$apacheRequestHeaders['Authorization']</code> - <code>$apacheRequestHeaders['authorization']</code> + <code><![CDATA[$apacheRequestHeaders['Authorization']]]></code> + <code><![CDATA[$apacheRequestHeaders['authorization']]]></code> </MixedArrayAccess> <MixedAssignment> <code>$apacheRequestHeaders</code> - <code>$server['HTTP_AUTHORIZATION']</code> - <code>$server['HTTP_AUTHORIZATION']</code> + <code><![CDATA[$server['HTTP_AUTHORIZATION']]]></code> + <code><![CDATA[$server['HTTP_AUTHORIZATION']]]></code> </MixedAssignment> </file> <file src="src/functions/normalize_uploaded_files.legacy.php"> @@ -460,25 +478,25 @@ $nameTree[$key] ?? null, $typeTree[$key] ?? null )</code> - <code>$recursiveNormalize( + <code><![CDATA[$recursiveNormalize( $files['tmp_name'], $files['size'], $files['error'], $files['name'] ?? null, $files['type'] ?? null - )</code> + )]]></code> </MixedFunctionCall> <MixedInferredReturnType> <code>array</code> </MixedInferredReturnType> <MixedReturnStatement> - <code>$recursiveNormalize( + <code><![CDATA[$recursiveNormalize( $files['tmp_name'], $files['size'], $files['error'], $files['name'] ?? null, $files['type'] ?? null - )</code> + )]]></code> </MixedReturnStatement> </file> <file src="src/functions/parse_cookie_header.legacy.php"> @@ -491,7 +509,7 @@ <code>$cookies</code> </LessSpecificReturnStatement> <MoreSpecificReturnType> - <code>array<non-empty-string, string></code> + <code><![CDATA[array<non-empty-string, string>]]></code> </MoreSpecificReturnType> </file> <file src="test/CallbackStreamTest.php"> @@ -502,7 +520,7 @@ </file> <file src="test/Integration/UploadedFileTest.php"> <PossiblyNullArgument> - <code>$stream->getSize()</code> + <code><![CDATA[$stream->getSize()]]></code> </PossiblyNullArgument> </file> <file src="test/MessageTraitTest.php"> @@ -547,7 +565,7 @@ <code>$responseCode</code> </MixedAssignment> <MoreSpecificReturnType> - <code>list<array{numeric-string, non-empty-string}></code> + <code><![CDATA[list<array{numeric-string, non-empty-string}>]]></code> </MoreSpecificReturnType> <RedundantConditionGivenDocblockType> <code>assertIsInt</code> @@ -558,7 +576,7 @@ </file> <file src="test/ServerRequestFactoryTest.php"> <InvalidArgument> - <code>$normalizedFiles['fooFiles']</code> + <code><![CDATA[$normalizedFiles['fooFiles']]]></code> </InvalidArgument> </file> <file src="test/ServerRequestTest.php"> @@ -587,23 +605,23 @@ </file> <file src="test/functions/NormalizeUploadedFilesTest.php"> <MixedArgument> - <code>$normalised['my-form']['details']['avatars']</code> - <code>$normalised['slide-shows'][0]['slides']</code> + <code><![CDATA[$normalised['my-form']['details']['avatars']]]></code> + <code><![CDATA[$normalised['slide-shows'][0]['slides']]]></code> </MixedArgument> <MixedArrayAccess> - <code>$normalised['my-form']['details']['avatar']</code> - <code>$normalised['my-form']['details']['avatars']</code> - <code>$normalised['my-form']['details']['avatars']</code> - <code>$normalised['my-form']['details']['avatars']</code> - <code>$normalised['my-form']['details']['avatars']</code> - <code>$normalised['my-form']['details']['avatars'][0]</code> - <code>$normalised['my-form']['details']['avatars'][1]</code> - <code>$normalised['my-form']['details']['avatars'][2]</code> - <code>$normalised['slide-shows'][0]['slides']</code> - <code>$normalised['slide-shows'][0]['slides']</code> - <code>$normalised['slide-shows'][0]['slides']</code> - <code>$normalised['slide-shows'][0]['slides'][0]</code> - <code>$normalised['slide-shows'][0]['slides'][1]</code> + <code><![CDATA[$normalised['my-form']['details']['avatar']]]></code> + <code><![CDATA[$normalised['my-form']['details']['avatars']]]></code> + <code><![CDATA[$normalised['my-form']['details']['avatars']]]></code> + <code><![CDATA[$normalised['my-form']['details']['avatars']]]></code> + <code><![CDATA[$normalised['my-form']['details']['avatars']]]></code> + <code><![CDATA[$normalised['my-form']['details']['avatars'][0]]]></code> + <code><![CDATA[$normalised['my-form']['details']['avatars'][1]]]></code> + <code><![CDATA[$normalised['my-form']['details']['avatars'][2]]]></code> + <code><![CDATA[$normalised['slide-shows'][0]['slides']]]></code> + <code><![CDATA[$normalised['slide-shows'][0]['slides']]]></code> + <code><![CDATA[$normalised['slide-shows'][0]['slides']]]></code> + <code><![CDATA[$normalised['slide-shows'][0]['slides'][0]]]></code> + <code><![CDATA[$normalised['slide-shows'][0]['slides'][1]]]></code> </MixedArrayAccess> <MixedMethodCall> <code>getClientFilename</code> @@ -614,14 +632,14 @@ <code>getClientFilename</code> </MixedMethodCall> <UndefinedInterfaceMethod> - <code>$normalised['my-form']</code> - <code>$normalised['my-form']</code> - <code>$normalised['my-form']</code> - <code>$normalised['my-form']</code> - <code>$normalised['my-form']</code> - <code>$normalised['slide-shows']</code> - <code>$normalised['slide-shows']</code> - <code>$normalised['slide-shows']</code> + <code><![CDATA[$normalised['my-form']]]></code> + <code><![CDATA[$normalised['my-form']]]></code> + <code><![CDATA[$normalised['my-form']]]></code> + <code><![CDATA[$normalised['my-form']]]></code> + <code><![CDATA[$normalised['my-form']]]></code> + <code><![CDATA[$normalised['slide-shows']]]></code> + <code><![CDATA[$normalised['slide-shows']]]></code> + <code><![CDATA[$normalised['slide-shows']]]></code> </UndefinedInterfaceMethod> </file> </files> 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')) {