From 1df9ad330f607674a81350901cb8cbce81f867d1 Mon Sep 17 00:00:00 2001 From: "P.H. Knot" <36478829+phknot@users.noreply.github.com> Date: Fri, 25 Jul 2025 15:26:02 +0200 Subject: [PATCH 1/5] fix: Use correct constructor for ApiException --- .../main/resources/php/libraries/psr-18/api.mustache | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache index f4277592c2d5..ca43585da299 100644 --- a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache @@ -301,9 +301,8 @@ use function sprintf; $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -806,9 +805,9 @@ use function sprintf; 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } From 71ff105a73135fd4803572701df4bac73c26b377 Mon Sep 17 00:00:00 2001 From: "P.H. Knot" <36478829+phknot@users.noreply.github.com> Date: Fri, 25 Jul 2025 15:58:33 +0200 Subject: [PATCH 2/5] chore: Generate samples --- .../php/psr-18/lib/Api/AnotherFakeApi.php | 11 ++- .../php/psr-18/lib/Api/DefaultApi.php | 11 ++- .../petstore/php/psr-18/lib/Api/FakeApi.php | 76 ++++++++----------- .../lib/Api/FakeClassnameTags123Api.php | 11 ++- .../petstore/php/psr-18/lib/Api/PetApi.php | 41 +++++----- .../petstore/php/psr-18/lib/Api/StoreApi.php | 21 +++-- .../petstore/php/psr-18/lib/Api/UserApi.php | 16 ++-- 7 files changed, 79 insertions(+), 108 deletions(-) diff --git a/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php index 359c820c90f2..99a993cfc047 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php @@ -251,9 +251,8 @@ public function call123TestSpecialTagsWithHttpInfo($client) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -514,9 +513,9 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } diff --git a/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php b/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php index 1957865ff582..0d0f19c299d2 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php @@ -245,9 +245,8 @@ public function fooGetWithHttpInfo() $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -489,9 +488,9 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } diff --git a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php index 67c95f5c189d..3258a8b3725a 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php @@ -245,9 +245,8 @@ public function fakeBigDecimalMapWithHttpInfo() $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -486,9 +485,8 @@ public function fakeEnumEndpointWithHttpInfo($enum_class, $enum_class_array, $en $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -785,9 +783,8 @@ public function fakeHealthGetWithHttpInfo() $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1256,9 +1253,8 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1498,9 +1494,8 @@ public function fakeOuterCompositeSerializeWithHttpInfo($outer_composite = null) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1740,9 +1735,8 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1982,9 +1976,8 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -2224,9 +2217,8 @@ public function fakePropertyEnumIntegerSerializeWithHttpInfo($outer_object_with_ $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -2489,9 +2481,8 @@ public function fakeWith400And4xxRangeResponseEndpointWithHttpInfo($pet) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -2763,9 +2754,8 @@ public function fakeWith400And4xxRangeResponseNo4xxDatatypeEndpointWithHttpInfo( $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -3025,9 +3015,8 @@ public function fakeWith400ResponseEndpointWithHttpInfo($pet) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -3296,9 +3285,8 @@ public function fakeWith4xxRangeResponseEndpointWithHttpInfo($pet) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -3562,9 +3550,8 @@ public function fakeWith4xxRangeResponseNo4xxDatatypeEndpointWithHttpInfo($pet) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -4933,9 +4920,8 @@ public function testClientModelWithHttpInfo($client) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -7349,9 +7335,9 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } diff --git a/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php index e27ebee24c73..c2cca4171189 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php @@ -251,9 +251,8 @@ public function testClassnameWithHttpInfo($client) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -519,9 +518,9 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } diff --git a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php index a002591b50c4..5d97a828bf8f 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php @@ -717,9 +717,8 @@ public function findPetsByStatusWithHttpInfo($status) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -978,9 +977,8 @@ public function findPetsByTagsWithHttpInfo($tags) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1240,9 +1238,8 @@ public function getPetByIdWithHttpInfo($pet_id) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1984,9 +1981,8 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -2266,9 +2262,8 @@ public function uploadFileWithRequiredFileWithHttpInfo($pet_id, $required_file, $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -2566,9 +2561,8 @@ public function uploadImageFullFormDataWithHttpInfo($pet_id, $name, $photo_urls, $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -2883,9 +2877,8 @@ public function uploadImageFullFormDataNestedWithHttpInfo($pet_id, $pet = null) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -3164,9 +3157,9 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } diff --git a/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php b/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php index 7ef48b61e58d..dfdf6c957069 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php @@ -460,9 +460,8 @@ public function getInventoryWithHttpInfo() $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -706,9 +705,8 @@ public function getOrderByIdWithHttpInfo($order_id) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -971,9 +969,8 @@ public function placeOrderWithHttpInfo($order) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1234,9 +1231,9 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } diff --git a/samples/client/petstore/php/psr-18/lib/Api/UserApi.php b/samples/client/petstore/php/psr-18/lib/Api/UserApi.php index e3c88d628d41..8b1275b5a21b 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/UserApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/UserApi.php @@ -1089,9 +1089,8 @@ public function getUserByNameWithHttpInfo($username) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -1349,9 +1348,8 @@ public function loginUserWithHttpInfo($username, $password) $statusCode, (string) $request->getUri() ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() + $request, + $response ); } @@ -2057,9 +2055,9 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - $response->getStatusCode(), - $response->getHeaders(), - $content + request, + $response, + $exception ); } } From aa9307b1e5eb618dbac8faf7e4b7dee487a49ee8 Mon Sep 17 00:00:00 2001 From: "P.H. Knot" <36478829+phknot@users.noreply.github.com> Date: Fri, 25 Jul 2025 16:01:59 +0200 Subject: [PATCH 3/5] fix: Missing $ --- .../src/main/resources/php/libraries/psr-18/api.mustache | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache index ca43585da299..039964ca4391 100644 --- a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache @@ -65,6 +65,7 @@ use function sprintf; /** * @var PluginClient */ + (string) $response->getBody() protected $httpAsyncClient; /** @@ -805,7 +806,7 @@ use function sprintf; 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception ); From 5e20fa762baccc75805b7a4364022cbca44e264d Mon Sep 17 00:00:00 2001 From: "P.H. Knot" <36478829+phknot@users.noreply.github.com> Date: Fri, 25 Jul 2025 16:17:35 +0200 Subject: [PATCH 4/5] fix: Remove extraneous line --- .../src/main/resources/php/libraries/psr-18/api.mustache | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache index 039964ca4391..6e8e78ac2ca5 100644 --- a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache @@ -65,7 +65,6 @@ use function sprintf; /** * @var PluginClient */ - (string) $response->getBody() protected $httpAsyncClient; /** From b98d0015d615ad0f59f731694728beed0fbcdbeb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Mon, 28 Jul 2025 20:14:02 +0800 Subject: [PATCH 5/5] update samples --- samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php | 2 +- samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php | 2 +- samples/client/petstore/php/psr-18/lib/Api/FakeApi.php | 2 +- .../petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php | 2 +- samples/client/petstore/php/psr-18/lib/Api/PetApi.php | 2 +- samples/client/petstore/php/psr-18/lib/Api/StoreApi.php | 2 +- samples/client/petstore/php/psr-18/lib/Api/UserApi.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php index 99a993cfc047..925251f3f1b7 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/AnotherFakeApi.php @@ -513,7 +513,7 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception ); diff --git a/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php b/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php index 0d0f19c299d2..6dc782e236a6 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/DefaultApi.php @@ -488,7 +488,7 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception ); diff --git a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php index 3258a8b3725a..40ec34828ad6 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeApi.php @@ -7335,7 +7335,7 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception ); diff --git a/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php index c2cca4171189..cb0c743d3436 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/psr-18/lib/Api/FakeClassnameTags123Api.php @@ -518,7 +518,7 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception ); diff --git a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php index b4d8b783e9af..9d6c136a9711 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php @@ -3167,7 +3167,7 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception ); diff --git a/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php b/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php index dfdf6c957069..d5f8860ff462 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/StoreApi.php @@ -1231,7 +1231,7 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception ); diff --git a/samples/client/petstore/php/psr-18/lib/Api/UserApi.php b/samples/client/petstore/php/psr-18/lib/Api/UserApi.php index 8b1275b5a21b..2ce27d09ddd1 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/UserApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/UserApi.php @@ -2055,7 +2055,7 @@ private function handleResponseWithDataType( 'Error JSON decoding server response (%s)', $request->getUri() ), - request, + $request, $response, $exception );