diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index ed9e346c31f..14cee8032b7 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -395,7 +395,8 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (reservedWords.contains(operationId)) { - throw new RuntimeException(operationId + " (reserved word) cannot be used as method name"); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true)); + operationId = "call_" + operationId; } return camelize(sanitizeName(operationId), true); diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.json b/modules/swagger-codegen/src/test/resources/2_0/petstore.json index e067c7b7a63..b74b455add1 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json @@ -263,7 +263,7 @@ ], "parameters": [ { - "name": "package", + "name": "petId", "in": "path", "description": "ID of pet that needs to be fetched", "required": true, diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index eb3d198892c..b77d3b237f1 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -879,7 +879,7 @@ class PetApi } /** - * getPetByIdWithByteArray + * petPetIdtestingByteArraytrueGet * * Fake endpoint to test byte array return by 'Find pet by ID' * @@ -887,15 +887,15 @@ class PetApi * @return ByteArray * @throws \Swagger\Client\ApiException on non-2xx response */ - public function getPetByIdWithByteArray($pet_id) + public function petPetIdtestingByteArraytrueGet($pet_id) { - list($response, $statusCode, $httpHeader) = $this->getPetByIdWithByteArrayWithHttpInfo ($pet_id); + list($response, $statusCode, $httpHeader) = $this->petPetIdtestingByteArraytrueGetWithHttpInfo ($pet_id); return $response; } /** - * getPetByIdWithByteArrayWithHttpInfo + * petPetIdtestingByteArraytrueGetWithHttpInfo * * Fake endpoint to test byte array return by 'Find pet by ID' * @@ -903,12 +903,12 @@ class PetApi * @return Array of ByteArray, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function getPetByIdWithByteArrayWithHttpInfo($pet_id) + public function petPetIdtestingByteArraytrueGetWithHttpInfo($pet_id) { // verify the required parameter 'pet_id' is set if ($pet_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetByIdWithByteArray'); + throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling petPetIdtestingByteArraytrueGet'); } // parse inputs diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 8163ef43b39..bc13b27411c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -180,7 +180,7 @@ class StoreApi } /** - * placeOrder + * callReturn * * Place an order for a pet * @@ -188,15 +188,15 @@ class StoreApi * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response */ - public function placeOrder($body = null) + public function callReturn($body = null) { - list($response, $statusCode, $httpHeader) = $this->placeOrderWithHttpInfo ($body); + list($response, $statusCode, $httpHeader) = $this->callReturnWithHttpInfo ($body); return $response; } /** - * placeOrderWithHttpInfo + * callReturnWithHttpInfo * * Place an order for a pet * @@ -204,7 +204,7 @@ class StoreApi * @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function placeOrderWithHttpInfo($body = null) + public function callReturnWithHttpInfo($body = null) { diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php index 3df47d97be1..0505fde1c57 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php @@ -146,12 +146,12 @@ class PetApiTest extends \PHPUnit_Framework_TestCase } /** - * Test case for getPetByIdWithByteArray + * Test case for petPetIdtestingByteArraytrueGet * * Fake endpoint to test byte array return by 'Find pet by ID' * */ - public function test_getPetByIdWithByteArray() { + public function test_petPetIdtestingByteArraytrueGet() { } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php index 899f5791c8a..8187547d681 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php @@ -76,12 +76,12 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase } /** - * Test case for placeOrder + * Test case for callReturn * * Place an order for a pet * */ - public function test_placeOrder() { + public function test_callReturn() { } diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index 65cf886f561..44d90936368 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -329,7 +329,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $pet_api = new Swagger\Client\Api\PetAPI($api_client); // test getPetByIdWithByteArray $pet_id = 10005; - $bytes = $pet_api->getPetByIdWithByteArray($pet_id); + $bytes = $pet_api->petPetIdtestingByteArraytrueGet($pet_id); $json = json_decode(call_user_func_array('pack', array_merge(array('C*'), $bytes )), true); $this->assertInternalType("array", $bytes);