diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 2a5145e1030..b42858a2494 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1122,6 +1122,20 @@ public class DefaultCodegen implements CodegenConfig { .replace("\"", "\\\"")); } + /** + * This method escapes text to be used in a single quoted string + * @param input the input string + * @return the escaped string + */ + public String escapeTextInSingleQuotes(String input) { + if (input == null) { + return null; + } + + return escapeText(input).replace("'", "\\'"); + } + + /** * Escape characters while allowing new lines * diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java index eaba6303835..3c3c91b9c7b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -753,7 +753,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen { "int".equalsIgnoreCase(datatype)) { return value; } else { - return "'" + escapeText(value) + "'"; + return "'" + escapeTextInSingleQuotes(value) + "'"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java index 040b6cddd24..b850b6bffc8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java @@ -641,9 +641,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg if ("String".equalsIgnoreCase(type) || p.isString) { if (example == null) { - example = "'" + p.paramName + "_example'"; + example = "'" + escapeTextInSingleQuotes(p.paramName) + "_example'"; + } else { + example = escapeText(example); } - example = escapeText(example); } else if ("Integer".equals(type) || "int".equals(type)) { if (example == null) { example = "56"; @@ -660,17 +661,17 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg if (example == null) { example = "/path/to/file.txt"; } - example = "\"" + escapeText(example) + "\""; + example = "'" + escapeTextInSingleQuotes(example) + "'"; } else if ("\\Date".equalsIgnoreCase(type)) { if (example == null) { example = "2013-10-20"; } - example = "new \\DateTime(\"" + escapeText(example) + "\")"; + example = "new \\DateTime('" + escapeTextInSingleQuotes(example) + "')"; } else if ("\\DateTime".equalsIgnoreCase(type)) { if (example == null) { example = "2013-10-20T19:20:30+01:00"; } - example = "new \\DateTime(\"" + escapeText(example) + "\")"; + example = "new \\DateTime('" + escapeTextInSingleQuotes(example) + "')"; } else if ("object".equals(type)) { example = "new \\stdClass"; } else if (!languageSpecificPrimitives.contains(type)) { @@ -718,7 +719,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg if ("int".equals(datatype) || "float".equals(datatype)) { return value; } else { - return "\'" + escapeText(value) + "\'"; + return "'" + escapeTextInSingleQuotes(value) + "'"; } } @@ -830,6 +831,16 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg return super.escapeText(input).trim(); } + @Override + public String escapeTextInSingleQuotes(String input) { + if (input == null) { + return input; + } + + // Unescape double quotes because PHP keeps the backslashes if a character does not need to be escaped + return super.escapeTextInSingleQuotes(input).replace("\\\"", "\""); + } + public void escapeMediaType(List operationList) { for (CodegenOperation op : operationList) { if (!op.hasProduces) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java index 8288294ffbd..6c49ce78fd7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java @@ -412,7 +412,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co // Enum case: example = schema.getEnum().get(0).toString(); if (ModelUtils.isStringSchema(schema)) { - example = "'" + escapeText(example) + "'"; + example = "'" + escapeTextInSingleQuotes(example) + "'"; } if (null == example) LOGGER.warn("Empty enum. Cannot built an example!"); @@ -511,7 +511,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co if (additional.getEnum() != null && !additional.getEnum().isEmpty()) { theKey = additional.getEnum().get(0).toString(); if (ModelUtils.isStringSchema(additional)) { - theKey = "'" + escapeText(theKey) + "'"; + theKey = "'" + escapeTextInSingleQuotes(theKey) + "'"; } } example = "{\n" + indentationString + theKey + " : " + toExampleValueRecursive(additional, includedSchemas, indentation + 1) + "\n" + indentationString + "}"; @@ -577,7 +577,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co } if (ModelUtils.isStringSchema(schema)) { - example = "'" + escapeText(example) + "'"; + example = "'" + escapeTextInSingleQuotes(example) + "'"; } return example; @@ -603,7 +603,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co if (example == null) { example = p.paramName + "_example"; } - example = "'" + escapeText(example) + "'"; + example = "'" + escapeTextInSingleQuotes(example) + "'"; } else if ("Integer".equals(type) || "int".equals(type)) { if (example == null) { example = "56"; @@ -620,17 +620,17 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co if (example == null) { example = "/path/to/file"; } - example = "'" + escapeText(example) + "'"; + example = "'" + escapeTextInSingleQuotes(example) + "'"; } else if ("Date".equalsIgnoreCase(type)) { if (example == null) { example = "2013-10-20"; } - example = "'" + escapeText(example) + "'"; + example = "'" + escapeTextInSingleQuotes(example) + "'"; } else if ("DateTime".equalsIgnoreCase(type)) { if (example == null) { example = "2013-10-20T19:20:30+01:00"; } - example = "'" + escapeText(example) + "'"; + example = "'" + escapeTextInSingleQuotes(example) + "'"; } else if (!languageSpecificPrimitives.contains(type)) { // type is a model class, e.g. User example = this.packageName + "." + type + "()"; @@ -1419,7 +1419,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co if ("int".equals(datatype) || "float".equals(datatype)) { return value; } else { - return "\'" + escapeText(value) + "\'"; + return "'" + escapeTextInSingleQuotes(value) + "'"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java index 8a0aa66e939..2a3c2ffef01 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java @@ -231,15 +231,6 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg return (outputFolder + File.separator + toSrcPath(controllerPackage, srcBasePath)); } - @Override - public String escapeText(String input) { - if (input != null) { - // Trim the string to avoid leading and trailing spaces. - return super.escapeText(input).trim(); - } - return input; - } - @Override public CodegenType getTag() { return CodegenType.SERVER; @@ -577,15 +568,6 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg } } - @Override - public String toEnumValue(String value, String datatype) { - if ("int".equals(datatype) || "float".equals(datatype)) { - return value; - } else { - return "\"" + escapeText(value) + "\""; - } - } - /** * Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33) * diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientCodegenTest.java index ae403621c0a..8570b527a18 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientCodegenTest.java @@ -85,4 +85,15 @@ public class DartClientCodegenTest { } } + + @Test(description = "Enum value with quotes (#17582)") + public void testEnumPropertyWithQuotes() { + final DartClientCodegen codegen = new DartClientCodegen(); + + Assert.assertEquals(codegen.toEnumValue("enum-value", "string"), "'enum-value'"); + Assert.assertEquals(codegen.toEnumValue("won't fix", "string"), "'won\\'t fix'"); + Assert.assertEquals(codegen.toEnumValue("\"", "string"), "'\\\"'"); + Assert.assertEquals(codegen.toEnumValue("1.0", "number"), "1.0"); + Assert.assertEquals(codegen.toEnumValue("1", "int"), "1"); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/AbstractPhpCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/AbstractPhpCodegenTest.java index a73cb73a76a..7ad989f0f88 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/AbstractPhpCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/AbstractPhpCodegenTest.java @@ -176,4 +176,13 @@ public class AbstractPhpCodegenTest { CodegenProperty cp1 = cm1.vars.get(0); Assert.assertEquals(cp1.getDefaultValue(), "'VALUE'"); } + + @Test(description = "Enum value with quotes (#17582)") + public void testEnumPropertyWithQuotes() { + Assert.assertEquals(codegen.toEnumValue("enum-value", "string"), "'enum-value'"); + Assert.assertEquals(codegen.toEnumValue("won't fix", "string"), "'won\\'t fix'"); + Assert.assertEquals(codegen.toEnumValue("\"", "string"), "'\"'"); + Assert.assertEquals(codegen.toEnumValue("1.0", "float"), "1.0"); + Assert.assertEquals(codegen.toEnumValue("1", "int"), "1"); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java index 57a877d465f..3510bb3e894 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientCodegenTest.java @@ -530,4 +530,15 @@ public class PythonClientCodegenTest { assertFileContains(apiFile.toPath(), "_header_params['X-CUSTOM_CONSTANT_HEADER'] = 'CONSTANT_VALUE'"); assertFileContains(apiFile.toPath(), "_query_params.append(('CONSTANT_QUERY_STRING_KEY', 'CONSTANT_QUERY_STRING_VALUE'))"); } + + @Test(description = "Enum value with quotes (#17582)") + public void testEnumPropertyWithQuotes() { + final PythonClientCodegen codegen = new PythonClientCodegen(); + + Assert.assertEquals(codegen.toEnumValue("enum-value", "string"), "'enum-value'"); + Assert.assertEquals(codegen.toEnumValue("won't fix", "string"), "'won\\'t fix'"); + Assert.assertEquals(codegen.toEnumValue("\"", "string"), "'\\\"'"); + Assert.assertEquals(codegen.toEnumValue("1.0", "float"), "1.0"); + Assert.assertEquals(codegen.toEnumValue("1", "int"), "1"); + } } diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/BodyApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/BodyApi.md index 6c26bb843ff..c34d181d7a0 100644 --- a/samples/client/echo_api/php-nextgen-streaming/docs/Api/BodyApi.md +++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/BodyApi.md @@ -92,7 +92,7 @@ $apiInstance = new OpenAPI\Client\Api\BodyApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = "/path/to/file.txt"; // \Psr\Http\Message\StreamInterface +$body = '/path/to/file.txt'; // \Psr\Http\Message\StreamInterface try { $result = $apiInstance->testBodyApplicationOctetstreamBinary($body); @@ -148,7 +148,7 @@ $apiInstance = new OpenAPI\Client\Api\BodyApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$files = array("/path/to/file.txt"); // \Psr\Http\Message\StreamInterface[] +$files = array('/path/to/file.txt'); // \Psr\Http\Message\StreamInterface[] try { $result = $apiInstance->testBodyMultipartFormdataArrayOfBinary($files); @@ -204,7 +204,7 @@ $apiInstance = new OpenAPI\Client\Api\BodyApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$my_file = "/path/to/file.txt"; // \Psr\Http\Message\StreamInterface +$my_file = '/path/to/file.txt'; // \Psr\Http\Message\StreamInterface try { $result = $apiInstance->testBodyMultipartFormdataSingleBinary($my_file); diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md b/samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md index 7e1a9f372b8..ae6ca517039 100644 --- a/samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md +++ b/samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md @@ -97,8 +97,8 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$datetime_query = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime -$date_query = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime +$datetime_query = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime +$date_query = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime $string_query = 'string_query_example'; // string try { diff --git a/samples/client/echo_api/php-nextgen/docs/Api/BodyApi.md b/samples/client/echo_api/php-nextgen/docs/Api/BodyApi.md index f9b966860b7..e9fb3e75266 100644 --- a/samples/client/echo_api/php-nextgen/docs/Api/BodyApi.md +++ b/samples/client/echo_api/php-nextgen/docs/Api/BodyApi.md @@ -92,7 +92,7 @@ $apiInstance = new OpenAPI\Client\Api\BodyApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = "/path/to/file.txt"; // \SplFileObject +$body = '/path/to/file.txt'; // \SplFileObject try { $result = $apiInstance->testBodyApplicationOctetstreamBinary($body); @@ -148,7 +148,7 @@ $apiInstance = new OpenAPI\Client\Api\BodyApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$files = array("/path/to/file.txt"); // \SplFileObject[] +$files = array('/path/to/file.txt'); // \SplFileObject[] try { $result = $apiInstance->testBodyMultipartFormdataArrayOfBinary($files); @@ -204,7 +204,7 @@ $apiInstance = new OpenAPI\Client\Api\BodyApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$my_file = "/path/to/file.txt"; // \SplFileObject +$my_file = '/path/to/file.txt'; // \SplFileObject try { $result = $apiInstance->testBodyMultipartFormdataSingleBinary($my_file); diff --git a/samples/client/echo_api/php-nextgen/docs/Api/QueryApi.md b/samples/client/echo_api/php-nextgen/docs/Api/QueryApi.md index 7e1a9f372b8..ae6ca517039 100644 --- a/samples/client/echo_api/php-nextgen/docs/Api/QueryApi.md +++ b/samples/client/echo_api/php-nextgen/docs/Api/QueryApi.md @@ -97,8 +97,8 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$datetime_query = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime -$date_query = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime +$datetime_query = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime +$date_query = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime $string_query = 'string_query_example'; // string try { diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md index 9f4cab79f2a..f9994a6971d 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/FakeApi.md @@ -608,7 +608,7 @@ $apiInstance = new OpenAPI\Client\Api\FakeApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = "/path/to/file.txt"; // \SplFileObject | image to upload +$body = '/path/to/file.txt'; // \SplFileObject | image to upload try { $apiInstance->testBodyWithBinary($body); @@ -844,9 +844,9 @@ $int32 = 56; // int | None $int64 = 56; // int | None $float = 3.4; // float | None $string = 'string_example'; // string | None -$binary = "/path/to/file.txt"; // \SplFileObject | None -$date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | None -$date_time = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | None +$binary = '/path/to/file.txt'; // \SplFileObject | None +$date = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | None +$date_time = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | None $password = 'password_example'; // string | None $callback = 'callback_example'; // string | None diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md index 03a95d599d9..7cc169e98bb 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/docs/Api/PetApi.md @@ -514,7 +514,7 @@ $apiInstance = new OpenAPI\Client\Api\PetApi( ); $pet_id = 56; // int | ID of pet to update $additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server -$file = "/path/to/file.txt"; // \SplFileObject | file to upload +$file = '/path/to/file.txt'; // \SplFileObject | file to upload try { $result = $apiInstance->uploadFile($pet_id, $additional_metadata, $file); @@ -577,7 +577,7 @@ $apiInstance = new OpenAPI\Client\Api\PetApi( $config ); $pet_id = 56; // int | ID of pet to update -$required_file = "/path/to/file.txt"; // \SplFileObject | file to upload +$required_file = '/path/to/file.txt'; // \SplFileObject | file to upload $additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server try { diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md index 87e2653832d..48d5bad2c16 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -669,7 +669,7 @@ $apiInstance = new OpenAPI\Client\Api\FakeApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = "/path/to/file.txt"; // \SplFileObject | image to upload +$body = '/path/to/file.txt'; // \SplFileObject | image to upload try { $apiInstance->testBodyWithBinary($body); @@ -905,9 +905,9 @@ $int32 = 56; // int | None $int64 = 56; // int | None $float = 3.4; // float | None $string = 'string_example'; // string | None -$binary = "/path/to/file.txt"; // \SplFileObject | None -$date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | None -$date_time = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | None +$binary = '/path/to/file.txt'; // \SplFileObject | None +$date = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | None +$date_time = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | None $password = 'password_example'; // string | None $callback = 'callback_example'; // string | None diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md index 527942413c6..3a832aa82a5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/PetApi.md @@ -514,7 +514,7 @@ $apiInstance = new OpenAPI\Client\Api\PetApi( ); $pet_id = 56; // int | ID of pet to update $additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server -$file = "/path/to/file.txt"; // \SplFileObject | file to upload +$file = '/path/to/file.txt'; // \SplFileObject | file to upload try { $result = $apiInstance->uploadFile($pet_id, $additional_metadata, $file); @@ -577,7 +577,7 @@ $apiInstance = new OpenAPI\Client\Api\PetApi( $config ); $pet_id = 56; // int | ID of pet to update -$required_file = "/path/to/file.txt"; // \SplFileObject | file to upload +$required_file = '/path/to/file.txt'; // \SplFileObject | file to upload $additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server try { diff --git a/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md b/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md index a63a2afacf0..5c75d390deb 100644 --- a/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/psr-18/docs/Api/FakeApi.md @@ -669,7 +669,7 @@ $apiInstance = new OpenAPI\Client\Api\FakeApi( // This is optional, `Psr18ClientDiscovery` will be used to find http client. For instance `GuzzleHttp\Client` implements that interface new GuzzleHttp\Client() ); -$body = "/path/to/file.txt"; // \SplFileObject | image to upload +$body = '/path/to/file.txt'; // \SplFileObject | image to upload try { $apiInstance->testBodyWithBinary($body); @@ -905,9 +905,9 @@ $int32 = 56; // int | None $int64 = 56; // int | None $float = 3.4; // float | None $string = 'string_example'; // string | None -$binary = "/path/to/file.txt"; // \SplFileObject | None -$date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | None -$date_time = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | None +$binary = '/path/to/file.txt'; // \SplFileObject | None +$date = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | None +$date_time = new \DateTime('2013-10-20T19:20:30+01:00'); // \DateTime | None $password = 'password_example'; // string | None $callback = 'callback_example'; // string | None diff --git a/samples/client/petstore/php/psr-18/docs/Api/PetApi.md b/samples/client/petstore/php/psr-18/docs/Api/PetApi.md index 568f6c4c6e9..1c7add7728a 100644 --- a/samples/client/petstore/php/psr-18/docs/Api/PetApi.md +++ b/samples/client/petstore/php/psr-18/docs/Api/PetApi.md @@ -468,7 +468,7 @@ $apiInstance = new OpenAPI\Client\Api\PetApi( ); $pet_id = 56; // int | ID of pet to update $additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server -$file = "/path/to/file.txt"; // \SplFileObject | file to upload +$file = '/path/to/file.txt'; // \SplFileObject | file to upload try { $result = $apiInstance->uploadFile($pet_id, $additional_metadata, $file); @@ -531,7 +531,7 @@ $apiInstance = new OpenAPI\Client\Api\PetApi( $config ); $pet_id = 56; // int | ID of pet to update -$required_file = "/path/to/file.txt"; // \SplFileObject | file to upload +$required_file = '/path/to/file.txt'; // \SplFileObject | file to upload $additional_metadata = 'additional_metadata_example'; // string | Additional data to pass to server try { diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php index c9bf53c92e2..e735fe2955f 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php @@ -255,7 +255,7 @@ class PetController extends Controller $asserts = []; $asserts[] = new Assert\NotNull(); $asserts[] = new Assert\All([ - new Assert\Choice([ "available", "pending", "sold" ]) + new Assert\Choice([ 'available', 'pending', 'sold' ]) ]); $asserts[] = new Assert\All([ new Assert\Type("string"), diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/EnumStringModel.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/EnumStringModel.php index 5cf945fa9b0..6649451bc5c 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/EnumStringModel.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/EnumStringModel.php @@ -44,9 +44,9 @@ use JMS\Serializer\Annotation\SerializedName; */ enum EnumStringModel: string { - case AVAILABLE = "available"; - case PENDING = "pending"; - case SOLD = "sold"; + case AVAILABLE = 'available'; + case PENDING = 'pending'; + case SOLD = 'sold'; } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php index 6434aa9121f..2aa65aa47a7 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Order.php @@ -84,7 +84,7 @@ class Order * @SerializedName("status") * @Type("string") */ - #[Assert\Choice(["placed", "approved", "delivered"])] + #[Assert\Choice(['placed', 'approved', 'delivered'])] #[Assert\Type("string")] protected ?string $status = null; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php index deda58c617e..5f229ab6bb1 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Model/Pet.php @@ -98,7 +98,7 @@ class Pet * @SerializedName("status") * @Type("string") */ - #[Assert\Choice(["available", "pending", "sold"])] + #[Assert\Choice(['available', 'pending', 'sold'])] #[Assert\Type("string")] protected ?string $status = null;