aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/php/php_generator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/php/php_generator.cc')
-rw-r--r--src/google/protobuf/compiler/php/php_generator.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
index 36f00acd..ec9a2365 100644
--- a/src/google/protobuf/compiler/php/php_generator.cc
+++ b/src/google/protobuf/compiler/php/php_generator.cc
@@ -757,12 +757,15 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
std::string fullname = FilenameToClassname(filename);
int lastindex = fullname.find_last_of("\\");
- GenerateEnumDocComment(&printer, en);
- if (lastindex != string::npos) {
+ if (!file->package().empty()) {
printer.Print(
"namespace ^name^;\n\n",
"name", fullname.substr(0, lastindex));
+ }
+ GenerateEnumDocComment(&printer, en);
+
+ if (lastindex != string::npos) {
printer.Print(
"class ^name^\n"
"{\n",