Skip to content

Commit

Permalink
Merge pull request #1270 from xhh/php-sanitize-model-name
Browse files Browse the repository at this point in the history
Fix #1145: sanitize model name in PHP client
  • Loading branch information
wing328 committed Sep 23, 2015
2 parents d09d8bb + 09add2d commit 770ea9d
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ public String toParamName(String name) {

@Override
public String toModelName(String name) {
// Note: backslash ("\\") is allowed for e.g. "\\DateTime"
name = name.replaceAll("[^\\w\\\\]+", "_");

// model name cannot use reserved keyword
if (reservedWords.contains(name)) {
escapeReservedWord(name); // e.g. return => _return
Expand Down

0 comments on commit 770ea9d

Please sign in to comment.