better model name for php

This commit is contained in:
wing328
2016-03-04 14:26:28 +08:00
parent adc4547c8c
commit ae54301ed7
7 changed files with 799 additions and 0 deletions

View File

@@ -358,6 +358,9 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public String toModelName(String name) {
// remove [
name = name.replaceAll("\\]", "");
// Note: backslash ("\\") is allowed for e.g. "\\DateTime"
name = name.replaceAll("[^\\w\\\\]+", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.