From b7081f0bafcae56fb3faa96511abda6aa803967f Mon Sep 17 00:00:00 2001 From: Robert Lu Date: Thu, 15 Sep 2016 10:48:16 +0800 Subject: [PATCH] THRIFT-3929 php namespace remove tail "\\" --- compiler/cpp/src/generate/t_php_generator.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/generate/t_php_generator.cc index 2fa9b24d8db..ad0581eb04e 100644 --- a/compiler/cpp/src/generate/t_php_generator.cc +++ b/compiler/cpp/src/generate/t_php_generator.cc @@ -227,11 +227,14 @@ class t_php_generator : public t_oop_generator { 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