diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java index 5f84bab486d8..259916c0ebae 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java @@ -188,6 +188,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List phpReturnTypeOptions = new LinkedHashSet<>(); Set docReturnTypeOptions = new LinkedHashSet<>(); + boolean hasEmptyResponse = false; for (CodegenResponse response : operation.responses) { if (response.dataType != null) { @@ -200,6 +201,8 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, ListfakeDeletePetWithHttpInfo($pet_id, $contentType); return $response; @@ -3225,12 +3225,12 @@ public function fakeWith400And4xxRangeResponseEndpointRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\Pet + * @return \OpenAPI\Client\Model\Pet|null */ public function fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint( \OpenAPI\Client\Model\Pet $pet, string $contentType = self::contentTypes['fakeWith400And4xxRangeResponseNo4xxDatatypeEndpoint'][0] - ): \OpenAPI\Client\Model\Pet + ): ?\OpenAPI\Client\Model\Pet { list($response) = $this->fakeWith400And4xxRangeResponseNo4xxDatatypeEndpointWithHttpInfo($pet, $contentType); return $response; @@ -4094,12 +4094,12 @@ public function fakeWith4xxRangeResponseEndpointRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\Pet + * @return \OpenAPI\Client\Model\Pet|null */ public function fakeWith4xxRangeResponseNo4xxDatatypeEndpoint( \OpenAPI\Client\Model\Pet $pet, string $contentType = self::contentTypes['fakeWith4xxRangeResponseNo4xxDatatypeEndpoint'][0] - ): \OpenAPI\Client\Model\Pet + ): ?\OpenAPI\Client\Model\Pet { list($response) = $this->fakeWith4xxRangeResponseNo4xxDatatypeEndpointWithHttpInfo($pet, $contentType); return $response; diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php index ffdb74b3826c..62aacbec4d04 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php @@ -808,12 +808,12 @@ public function deletePetRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\Pet[] + * @return \OpenAPI\Client\Model\Pet[]|null */ public function findPetsByStatus( array $status, string $contentType = self::contentTypes['findPetsByStatus'][0] - ): array + ): ?array { list($response) = $this->findPetsByStatusWithHttpInfo($status, $contentType); return $response; @@ -1093,13 +1093,13 @@ public function findPetsByStatusRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\Pet[] + * @return \OpenAPI\Client\Model\Pet[]|null * @deprecated */ public function findPetsByTags( array $tags, string $contentType = self::contentTypes['findPetsByTags'][0] - ): array + ): ?array { list($response) = $this->findPetsByTagsWithHttpInfo($tags, $contentType); return $response; @@ -1383,12 +1383,12 @@ public function findPetsByTagsRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\Pet + * @return \OpenAPI\Client\Model\Pet|null */ public function getPetById( int $pet_id, string $contentType = self::contentTypes['getPetById'][0] - ): \OpenAPI\Client\Model\Pet + ): ?\OpenAPI\Client\Model\Pet { list($response) = $this->getPetByIdWithHttpInfo($pet_id, $contentType); return $response; diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php index 352d81d47227..a3ac3cca2771 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php @@ -636,12 +636,12 @@ public function getInventoryRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\Order + * @return \OpenAPI\Client\Model\Order|null */ public function getOrderById( int $order_id, string $contentType = self::contentTypes['getOrderById'][0] - ): \OpenAPI\Client\Model\Order + ): ?\OpenAPI\Client\Model\Order { list($response) = $this->getOrderByIdWithHttpInfo($order_id, $contentType); return $response; @@ -922,12 +922,12 @@ public function getOrderByIdRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\Order + * @return \OpenAPI\Client\Model\Order|null */ public function placeOrder( \OpenAPI\Client\Model\Order $order, string $contentType = self::contentTypes['placeOrder'][0] - ): \OpenAPI\Client\Model\Order + ): ?\OpenAPI\Client\Model\Order { list($response) = $this->placeOrderWithHttpInfo($order, $contentType); return $response; diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php index e0d556285746..0483a7812be2 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php @@ -1081,12 +1081,12 @@ public function deleteUserRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return \OpenAPI\Client\Model\User + * @return \OpenAPI\Client\Model\User|null */ public function getUserByName( string $username, string $contentType = self::contentTypes['getUserByName'][0] - ): \OpenAPI\Client\Model\User + ): ?\OpenAPI\Client\Model\User { list($response) = $this->getUserByNameWithHttpInfo($username, $contentType); return $response; @@ -1362,13 +1362,13 @@ public function getUserByNameRequest( * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return string + * @return string|null */ public function loginUser( string $username, string $password, string $contentType = self::contentTypes['loginUser'][0] - ): string + ): ?string { list($response) = $this->loginUserWithHttpInfo($username, $password, $contentType); return $response;