From 54de93e1cdc15484251db7c67839114b6e0b187d Mon Sep 17 00:00:00 2001 From: Marc Itzenthaler Date: Sun, 6 Oct 2024 02:30:07 +0200 Subject: [PATCH] Added new option methodNamingConvention to abstract php class --- docs/generators/php-dt.md | 1 + docs/generators/php-flight.md | 1 + docs/generators/php-laravel.md | 1 + docs/generators/php-lumen.md | 1 + docs/generators/php-mezzio-ph.md | 1 + docs/generators/php-nextgen.md | 1 + docs/generators/php-slim4.md | 1 + docs/generators/php-symfony.md | 1 + docs/generators/php.md | 1 + .../codegen/languages/AbstractPhpCodegen.java | 52 ++++++++++++++++--- .../lumen/PhpLumenServerOptionsTest.java | 1 + .../options/PhpClientOptionsProvider.java | 2 + .../PhpLumenServerOptionsProvider.java | 3 ++ .../PhpSlim4ServerOptionsProvider.java | 2 + .../codegen/php/PhpClientOptionsTest.java | 1 + 15 files changed, 64 insertions(+), 6 deletions(-) diff --git a/docs/generators/php-dt.md b/docs/generators/php-dt.md index 2cfe33eb3a7a..d441494bb76a 100644 --- a/docs/generators/php-dt.md +++ b/docs/generators/php-dt.md @@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |modern|use modern language features (generated code will require PHP 8.1)| |false| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| diff --git a/docs/generators/php-flight.md b/docs/generators/php-flight.md index 8b7c90a069be..b1448e198879 100644 --- a/docs/generators/php-flight.md +++ b/docs/generators/php-flight.md @@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-laravel.md b/docs/generators/php-laravel.md index 0d452d056064..09fbdcc58a83 100644 --- a/docs/generators/php-laravel.md +++ b/docs/generators/php-laravel.md @@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-lumen.md b/docs/generators/php-lumen.md index 39203422b3d4..28ed18fc12db 100644 --- a/docs/generators/php-lumen.md +++ b/docs/generators/php-lumen.md @@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-mezzio-ph.md b/docs/generators/php-mezzio-ph.md index d724c85d0878..01a2a876b39c 100644 --- a/docs/generators/php-mezzio-ph.md +++ b/docs/generators/php-mezzio-ph.md @@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |modern|use modern language features (generated code will require PHP 8.0)| |false| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| diff --git a/docs/generators/php-nextgen.md b/docs/generators/php-nextgen.md index 434804de2089..5e233972470b 100644 --- a/docs/generators/php-nextgen.md +++ b/docs/generators/php-nextgen.md @@ -32,6 +32,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-slim4.md b/docs/generators/php-slim4.md index 7f3ca80191de..9ed69481397c 100644 --- a/docs/generators/php-slim4.md +++ b/docs/generators/php-slim4.md @@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| diff --git a/docs/generators/php-symfony.md b/docs/generators/php-symfony.md index 0e183bc9cc2e..4c3f7e20be28 100644 --- a/docs/generators/php-symfony.md +++ b/docs/generators/php-symfony.md @@ -36,6 +36,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |invokerPackage|The main namespace to use for all classes. e.g. Yay\Pets| |null| |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |phpLegacySupport|Should the generated code be compatible with PHP 5.x?| |true| diff --git a/docs/generators/php.md b/docs/generators/php.md index b3997fb00d7e..2e711e999552 100644 --- a/docs/generators/php.md +++ b/docs/generators/php.md @@ -33,6 +33,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| |library|HTTP library template (sub-template) to use|
**guzzle**
Guzzle
**psr-18**
psr/http-client-implementation, also known as PSR-18. (beta support)
|guzzle| |licenseName|The name of the license| |null| +|methodNamingConvention|naming convention of class method name, e.g. PascalCase.| |PascalCase| |modelPackage|package for generated models| |null| |packageName|The main package name for classes. e.g. GeneratedPetstore| |null| |prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| 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 040b6cddd248..7b8a7eb8c7e2 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 @@ -47,6 +47,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg private final Logger LOGGER = LoggerFactory.getLogger(AbstractPhpCodegen.class); public static final String VARIABLE_NAMING_CONVENTION = "variableNamingConvention"; + public static final String METHOD_NAMING_CONVENTION = "methodNamingConvention"; public static final String PACKAGE_NAME = "packageName"; public static final String SRC_BASE_PATH = "srcBasePath"; @Getter @Setter @@ -64,6 +65,8 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg protected String apiDirName = "Api"; protected String modelDirName = "Model"; protected String variableNamingConvention = "snake_case"; + @Getter @Setter + protected String methodNamingConvention = "PascalCase"; protected String apiDocPath = docsBasePath + "/" + apiDirName; protected String modelDocPath = docsBasePath + "/" + modelDirName; protected String interfaceNamePrefix = "", interfaceNameSuffix = "Interface"; @@ -150,6 +153,8 @@ public AbstractPhpCodegen() { cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); cliOptions.add(new CliOption(VARIABLE_NAMING_CONVENTION, "naming convention of variable name, e.g. camelCase.") .defaultValue("snake_case")); + cliOptions.add(new CliOption(METHOD_NAMING_CONVENTION, "naming convention of class method name, e.g. PascalCase.") + .defaultValue("PascalCase")); cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, "The main namespace to use for all classes. e.g. Yay\\Pets")); cliOptions.add(new CliOption(PACKAGE_NAME, "The main package name for classes. e.g. GeneratedPetstore")); cliOptions.add(new CliOption(SRC_BASE_PATH, "The directory to serve as source root.")); @@ -245,6 +250,10 @@ public void processOpts() { this.setParameterNamingConvention((String) additionalProperties.get(VARIABLE_NAMING_CONVENTION)); } + if (additionalProperties.containsKey(METHOD_NAMING_CONVENTION)) { + this.setMethodNamingConvention((String) additionalProperties.get(METHOD_NAMING_CONVENTION)); + } + if (additionalProperties.containsKey(CodegenConstants.GIT_USER_ID)) { this.setGitUserId((String) additionalProperties.get(CodegenConstants.GIT_USER_ID)); } @@ -427,8 +436,11 @@ public void setParameterNamingConvention(String variableNamingConvention) { this.variableNamingConvention = variableNamingConvention; } - @Override - public String toVarName(String name) { + /** + * Abstracted method to get non convention var name because convention is handled + * different for toVarName and getter and setter + */ + private String toNonConventionVarName(String name) { // obtain the name from nameMapping directly if provided if (nameMapping.containsKey(name)) { return nameMapping.get(name); @@ -441,6 +453,19 @@ public String toVarName(String name) { // sanitize name name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + // parameter name starting with number won't compile + // need to escape it by appending _ at the beginning + if (name.matches("^\\d.*")) { + name = "_" + name; + } + + return name; + } + + @Override + public String toVarName(String name) { + name = toNonConventionVarName(name); + if ("camelCase".equals(variableNamingConvention)) { // return the name in camelCase style // phone_number => phoneNumber @@ -453,10 +478,25 @@ public String toVarName(String name) { name = underscore(name); } - // parameter name starting with number won't compile - // need to escape it by appending _ at the beginning - if (name.matches("^\\d.*")) { - name = "_" + name; + return name; + } + + @Override + public String getterAndSetterCapitalize(String name) { + name = toNonConventionVarName(name); + + if ("snake_case".equals(methodNamingConvention)) { + // return the name in underscore style and prepend with _ to get method separation (e.g. get_phone_number) + // PhoneNumber => phone_number + name = "_" + underscore(name); + } else if ("camelCase".equals(methodNamingConvention)) { + // return the name in camelCase style + // phone_number => phoneNumber + name = camelize(name, LOWERCASE_FIRST_LETTER); + } else { + // return the name in PascalCase style + // phone_number => PhoneNumber + name = camelize(name); } return name; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java index c8b4cbb76e1c..22990dcff960 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/lumen/PhpLumenServerOptionsTest.java @@ -42,6 +42,7 @@ protected CodegenConfig getCodegenConfig() { protected void verifyOptions() { verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpLumenServerOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setParameterNamingConvention(PhpLumenServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); + verify(clientCodegen).setMethodNamingConvention(PhpLumenServerOptionsProvider.METHOD_NAMING_CONVENTION_VALUE); verify(clientCodegen).setModelPackage(PhpLumenServerOptionsProvider.MODEL_PACKAGE_VALUE); verify(clientCodegen).setApiPackage(PhpLumenServerOptionsProvider.API_PACKAGE_VALUE); verify(clientCodegen).setInvokerPackage(PhpLumenServerOptionsProvider.INVOKER_PACKAGE_VALUE); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java index bf26ac750fa7..316303eb263f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpClientOptionsProvider.java @@ -30,6 +30,7 @@ public class PhpClientOptionsProvider implements OptionsProvider { public static final String SORT_MODEL_PROPERTIES_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String VARIABLE_NAMING_CONVENTION_VALUE = "snake_case"; + public static final String METHOD_NAMING_CONVENTION_VALUE = "PascalCase"; public static final String INVOKER_PACKAGE_VALUE = "OpenAPITools\\Client\\Php"; public static final String PACKAGE_NAME_VALUE = "OpenAPIToolsClient-php"; public static final String SRC_BASE_PATH_VALUE = "libPhp"; @@ -58,6 +59,7 @@ public Map createOptions() { .put(CodegenConstants.SORT_MODEL_PROPERTIES_BY_REQUIRED_FLAG, SORT_MODEL_PROPERTIES_VALUE) .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(PhpClientCodegen.VARIABLE_NAMING_CONVENTION, VARIABLE_NAMING_CONVENTION_VALUE) + .put(PhpClientCodegen.METHOD_NAMING_CONVENTION, METHOD_NAMING_CONVENTION_VALUE) .put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE) .put(PhpClientCodegen.PACKAGE_NAME, PACKAGE_NAME_VALUE) .put(PhpClientCodegen.SRC_BASE_PATH, SRC_BASE_PATH_VALUE) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java index ee795a038735..b6cc89086c14 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpLumenServerOptionsProvider.java @@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableMap; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.languages.AbstractPhpCodegen; +import org.openapitools.codegen.languages.PhpClientCodegen; import java.util.Map; @@ -30,6 +31,7 @@ public class PhpLumenServerOptionsProvider implements OptionsProvider { public static final String SORT_MODEL_PROPERTIES_VALUE = "false"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String VARIABLE_NAMING_CONVENTION_VALUE = "snake_case"; + public static final String METHOD_NAMING_CONVENTION_VALUE = "PascalCase"; public static final String INVOKER_PACKAGE_VALUE = "lumen"; public static final String PACKAGE_NAME_VALUE = "php"; public static final String SRC_BASE_PATH_VALUE = "libPhp"; @@ -53,6 +55,7 @@ public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE) .put(AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION, VARIABLE_NAMING_CONVENTION_VALUE) + .put(AbstractPhpCodegen.METHOD_NAMING_CONVENTION, METHOD_NAMING_CONVENTION_VALUE) .put(AbstractPhpCodegen.PACKAGE_NAME, PACKAGE_NAME_VALUE) .put(AbstractPhpCodegen.SRC_BASE_PATH, SRC_BASE_PATH_VALUE) .put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java index 7ebaece2aae3..39d3e9514edc 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlim4ServerOptionsProvider.java @@ -28,6 +28,7 @@ public class PhpSlim4ServerOptionsProvider implements OptionsProvider { public static final String MODEL_PACKAGE_VALUE = "package"; public static final String API_PACKAGE_VALUE = "apiPackage"; public static final String VARIABLE_NAMING_CONVENTION_VALUE = "camelCase"; + public static final String METHOD_NAMING_CONVENTION_VALUE = "PascalCase"; public static final String INVOKER_PACKAGE_VALUE = "OpenAPIServer"; public static final String PACKAGE_NAME_VALUE = ""; public static final String SRC_BASE_PATH_VALUE = "src"; @@ -55,6 +56,7 @@ public Map createOptions() { ImmutableMap.Builder builder = new ImmutableMap.Builder(); return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE) .put(AbstractPhpCodegen.VARIABLE_NAMING_CONVENTION, VARIABLE_NAMING_CONVENTION_VALUE) + .put(AbstractPhpCodegen.METHOD_NAMING_CONVENTION, METHOD_NAMING_CONVENTION_VALUE) .put(AbstractPhpCodegen.PACKAGE_NAME, PACKAGE_NAME_VALUE) .put(AbstractPhpCodegen.SRC_BASE_PATH, SRC_BASE_PATH_VALUE) .put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE) diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java index b984010b8b59..cdcd0671ee84 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/php/PhpClientOptionsTest.java @@ -44,6 +44,7 @@ protected void verifyOptions() { verify(clientCodegen).setApiPackage(PhpClientOptionsProvider.API_PACKAGE_VALUE); verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(PhpClientOptionsProvider.SORT_PARAMS_VALUE)); verify(clientCodegen).setParameterNamingConvention(PhpClientOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE); + verify(clientCodegen).setMethodNamingConvention(PhpClientOptionsProvider.METHOD_NAMING_CONVENTION_VALUE); verify(clientCodegen).setInvokerPackage(PhpClientOptionsProvider.INVOKER_PACKAGE_VALUE); verify(clientCodegen).setPackageName(PhpClientOptionsProvider.PACKAGE_NAME_VALUE); verify(clientCodegen).setSrcBasePath(PhpClientOptionsProvider.SRC_BASE_PATH_VALUE);