Skip to content

Commit

Permalink
[php-nextgen] minor fix to return type (OpenAPITools#16752)
Browse files Browse the repository at this point in the history
* minor fix to return type

* use returnProperty
  • Loading branch information
wing328 authored Oct 8, 2023
1 parent f568001 commit 5fb6fcf
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ samples/server/petstore/php-slim4/composer.lock
samples/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
samples/server/petstore/php-mezzio-ph/composer.lock
samples/server/petstore/php-mezzio-ph-modern/composer.lock
samples/client/petstore/php-nextgen/OpenAPIClient-php/.phplint.cache/

# ts
samples/client/petstore/typescript-angular2/npm/npm-debug.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
if (operation.returnType == null) {
operation.vendorExtensions.putIfAbsent("x-php-return-type", "void");
} else {
operation.vendorExtensions.putIfAbsent("x-php-return-type", operation.returnType);
if (operation.returnProperty.isContainer) { // array or map
operation.vendorExtensions.putIfAbsent("x-php-return-type", "array");
} else {
operation.vendorExtensions.putIfAbsent("x-php-return-type", operation.returnType);
}
}

for (CodegenParameter param : operation.allParams) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{#vendorExtensions.x-group-parameters}}
array $associative_array
{{/vendorExtensions.x-group-parameters}}
): {{vendorExtensions.x-php-return-type}}
): {{{vendorExtensions.x-php-return-type}}}
{
{{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}}
return $response;{{/returnType}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
path:
- src/
- tests/
jobs: 10
extensions:
- php
exclude:
- vendor
warning: true
memory-limit: -1
no-cache: false
log-json: false
log-junit: false
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ public function deletePetRequest(
public function findPetsByStatus(
array $status,
string $contentType = self::contentTypes['findPetsByStatus'][0]
): \OpenAPI\Client\Model\Pet[]
): array
{
list($response) = $this->findPetsByStatusWithHttpInfo($status, $contentType);
return $response;
Expand Down Expand Up @@ -1131,7 +1131,7 @@ public function findPetsByStatusRequest(
public function findPetsByTags(
array $tags,
string $contentType = self::contentTypes['findPetsByTags'][0]
): \OpenAPI\Client\Model\Pet[]
): array
{
list($response) = $this->findPetsByTagsWithHttpInfo($tags, $contentType);
return $response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public function deleteOrderRequest(
*/
public function getInventory(
string $contentType = self::contentTypes['getInventory'][0]
): array&lt;string,int&gt;
): array
{
list($response) = $this->getInventoryWithHttpInfo($contentType);
return $response;
Expand Down

0 comments on commit 5fb6fcf

Please sign in to comment.