summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Lu <robberphex@gmail.com>2016-09-15 10:48:16 +0800
committerNobuaki Sukegawa <nsuke@apache.org>2016-09-26 01:42:03 +0900
commit346e23149573dc00da5eb7f415057b0266230010 (patch)
tree462c6e3b866dae676f90b3845fc93cdb201e484e
parent22ec64f88ab29e0b8b1249c32bcf0568bc02cebd (diff)
downloadthrift-346e23149573dc00da5eb7f415057b0266230010.tar.gz
THRIFT-3929 php namespace remove tail "\\"
This closes #1089
-rw-r--r--compiler/cpp/src/thrift/generate/t_php_generator.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/cpp/src/thrift/generate/t_php_generator.cc b/compiler/cpp/src/thrift/generate/t_php_generator.cc
index ba5278101..515e165d6 100644
--- a/compiler/cpp/src/thrift/generate/t_php_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_php_generator.cc
@@ -227,11 +227,14 @@ public:
return (nsglobal_.size() ? NSGLOBAL_AB : NSGLOBAL_B) + (ns.size() ? (ns + "\\") : "");
}
- // setting the namespace of a file: my\namespace
+ // return the namespace of a file:
+ // global\ns\sub\ns or global\ns or sub\ns
string php_namespace_suffix(const t_program* p) {
string ns = php_namespace_base(p);
- return (nsglobal_.size() ? NSGLOBAL_B : NSGLOBAL) + ns;
+ return NSGLOBAL
+ + (ns.size() && NSGLOBAL.size() ? "\\" : "")
+ + ns;
}
// add a directory to already existing namespace