diff --git a/composer.json b/composer.json index 62ec57186..835679a46 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "nette/utils": "^3.0 || ^4.0", "nikic/php-parser": "^4.0", "nyholm/symfony-bundle-test": "^3.0", - "phpstan/phpstan": "~1.10.67", + "phpstan/phpstan": "~2.0.0", "psalm/phar": "~5.14.1", "psr/cache": "^1.0 || ^2.0 || ^3.0", "swaggest/json-diff": "^3.7", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 64ae8355c..c157cd326 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,8 +1,6 @@ parameters: level: 6 treatPhpDocTypesAsCertain: false - checkMissingCallableSignature: true - checkMissingIterableValueType: false reportUnmatchedIgnoredErrors: false paths: - src @@ -13,5 +11,6 @@ parameters: - src/**/tests/* ignoreErrors: + - identifier: missingType.iterableValue - '#PHPDoc tag @throws with type Psr\\Cache\\CacheException is not subtype of Throwable$#' - '#^Dead catch - JsonException is never thrown in the try block\.$#' diff --git a/src/CodeGenerator/src/Generator/OperationGenerator.php b/src/CodeGenerator/src/Generator/OperationGenerator.php index 051e327b8..b29838863 100644 --- a/src/CodeGenerator/src/Generator/OperationGenerator.php +++ b/src/CodeGenerator/src/Generator/OperationGenerator.php @@ -116,9 +116,8 @@ public function generate(Operation $operation): void $method->addComment('@see ' . $documentation); } $method->addComment('@see ' . $operation->getApiReferenceDocumentationUrl()); - if (null !== $prefix = $operation->getService()->getEndpointPrefix()) { - $method->addComment('@see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-' . $prefix . '-' . $operation->getService()->getApiVersion() . '.html#' . strtolower($operation->getName())); - } + $prefix = $operation->getService()->getEndpointPrefix(); + $method->addComment('@see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-' . $prefix . '-' . $operation->getService()->getApiVersion() . '.html#' . strtolower($operation->getName())); [$doc, $memberClassNames] = $this->typeGenerator->generateDocblock($inputShape, $inputClass, true, false, false, [' \'@region\'?: string|null,']); $method->addComment($doc); foreach ($memberClassNames as $memberClassName) { diff --git a/src/CodeGenerator/src/Generator/ResponseParser/RestXmlParser.php b/src/CodeGenerator/src/Generator/ResponseParser/RestXmlParser.php index cf601cf87..0ec320257 100644 --- a/src/CodeGenerator/src/Generator/ResponseParser/RestXmlParser.php +++ b/src/CodeGenerator/src/Generator/ResponseParser/RestXmlParser.php @@ -366,12 +366,10 @@ private function createPopulateMethod(string $functionName, string $body, Shape ->setType(\SimpleXMLElement::class) ; - if (null !== $shape) { - [$returnType, $parameterType, $memberClassNames] = $this->typeGenerator->getPhpType($shape); - $method - ->setComment('@return ' . $parameterType); - $this->imports = array_merge($this->imports, $memberClassNames); - } + [$returnType, $parameterType, $memberClassNames] = $this->typeGenerator->getPhpType($shape); + $method + ->setComment('@return ' . $parameterType); + $this->imports = array_merge($this->imports, $memberClassNames); return $method; } diff --git a/src/CodeGenerator/src/Generator/TestGenerator.php b/src/CodeGenerator/src/Generator/TestGenerator.php index 310cdedfa..1c30e14c0 100644 --- a/src/CodeGenerator/src/Generator/TestGenerator.php +++ b/src/CodeGenerator/src/Generator/TestGenerator.php @@ -102,7 +102,7 @@ private function generateInput(Operation $operation, StructureShape $shape): voi break; case 'query': - $stub = substr(var_export($exampleInput ? (\is_array($exampleInput) ? http_build_query($exampleInput, '', '&', \PHP_QUERY_RFC3986) : $exampleInput) : " + $stub = substr(var_export($exampleInput ? http_build_query($exampleInput, '', '&', \PHP_QUERY_RFC3986) : " Action={$operation->getName()} &Version={$operation->getApiVersion()} ", true), 1, -1); diff --git a/src/Core/src/Signer/SignerV4.php b/src/Core/src/Signer/SignerV4.php index ec1d0b7be..84875e2b3 100644 --- a/src/Core/src/Signer/SignerV4.php +++ b/src/Core/src/Signer/SignerV4.php @@ -330,6 +330,7 @@ private function buildCanonicalQuery(Request $request): string continue; } + // @phpstan-ignore argument.unresolvableType sort($values); foreach ($values as $value) { $encodedQuery[] = rawurlencode($key) . '=' . rawurlencode($value);