Revert "Append field number to accessors if there is conflict (#6169)" (#6282)

This reverts commit 9a8ef05a34dab7583b6f253daca294d6b1bfb187.
diff --git a/php/tests/proto/test_wrapper_type_setters.proto b/php/tests/proto/test_wrapper_type_setters.proto
index 119bd25..41ca7f3 100644
--- a/php/tests/proto/test_wrapper_type_setters.proto
+++ b/php/tests/proto/test_wrapper_type_setters.proto
@@ -24,14 +24,3 @@
 
   map<string, google.protobuf.StringValue> map_string_value = 13;
 }
-
-message TestWrapperAccessorConflicts {
-  int32 normal_vs_wrapper_value = 1;
-  google.protobuf.Int32Value normal_vs_wrapper = 2;
-
-  int32 normal_vs_normal_value = 3;
-  int32 normal_vs_normal = 4;
-
-  google.protobuf.Int32Value wrapper_vs_wrapper_value = 5;
-  google.protobuf.Int32Value wrapper_vs_wrapper = 6;
-}
diff --git a/php/tests/wrapper_type_setters_test.php b/php/tests/wrapper_type_setters_test.php
index 35e3a7d..5509a17 100644
--- a/php/tests/wrapper_type_setters_test.php
+++ b/php/tests/wrapper_type_setters_test.php
@@ -16,44 +16,6 @@
 
 class WrapperTypeSettersTest extends TestBase
 {
-    public function testConflictNormalVsWrapper()
-    {
-        $m = new Foo\TestWrapperAccessorConflicts();
-
-        $m->setNormalVsWrapperValue1(1);
-        $this->assertSame(1, $m->getNormalVsWrapperValue1());
-
-        $m->setNormalVsWrapperValue2(1);
-        $this->assertSame(1, $m->getNormalVsWrapperValue2());
-
-        $wrapper = new Int32Value(["value" => 1]);
-        $m->setNormalVsWrapper($wrapper);
-        $this->assertSame(1, $m->getNormalVsWrapper()->getValue());
-    }
-
-    public function testConflictNormalVsNormal()
-    {
-        $m = new Foo\TestWrapperAccessorConflicts();
-
-        $m->setNormalVsNormalValue(1);
-        $this->assertSame(1, $m->getNormalVsNormalValue());
-
-        $m->setNormalVsNormal(1);
-        $this->assertSame(1, $m->getNormalVsNormal());
-    }
-
-    public function testConflictWrapperVsWrapper()
-    {
-        $m = new Foo\TestWrapperAccessorConflicts();
-
-        $m->setWrapperVsWrapperValueValue(1);
-        $this->assertSame(1, $m->getWrapperVsWrapperValueValue());
-
-        $wrapper = new Int32Value(["value" => 1]);
-        $m->setWrapperVsWrapperValue5($wrapper);
-        $this->assertSame(1, $m->getWrapperVsWrapperValue5()->getValue());
-    }
-
     /**
      * @dataProvider gettersAndSettersDataProvider
      */
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
index 8e40560..d7e33b2 100644
--- a/src/google/protobuf/compiler/php/php_generator.cc
+++ b/src/google/protobuf/compiler/php/php_generator.cc
@@ -655,58 +655,27 @@
 
 void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
                            io::Printer* printer) {
-  bool need_other_name_for_accessor = false;
-  bool need_other_name_for_wrapper_accessor = false;
-  const Descriptor* desc = field->containing_type();
-
-  if (!field->is_repeated() &&
-      field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
-      IsWrapperType(field)) {
-    // Check if there is any field called xxx_value
-    const FieldDescriptor* other =
-        desc->FindFieldByName(StrCat(field->name(), "_value"));
-    if (other != NULL) {
-      need_other_name_for_wrapper_accessor = true;
-    }
-  }
-
-  if (strings::EndsWith(field->name(), "_value")) {
-    std::size_t pos = (field->name()).find("_value");  
-    string name = (field->name()).substr(0, pos);
-    const FieldDescriptor* other = desc->FindFieldByName(name);
-    if (other != NULL &&
-        !other->is_repeated() &&
-        other->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
-        IsWrapperType(other)) {
-      need_other_name_for_accessor = true;
-    }
-  }
-
   const OneofDescriptor* oneof = field->containing_oneof();
 
   // Generate getter.
   if (oneof != NULL) {
     GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter);
     printer->Print(
-        "public function get^camel_name^^field_number^()\n"
+        "public function get^camel_name^()\n"
         "{\n"
         "    return $this->readOneof(^number^);\n"
         "}\n\n",
         "camel_name", UnderscoresToCamelCase(field->name(), true),
-        "number", IntToString(field->number()),
-        "field_number", need_other_name_for_accessor ?
-            StrCat(field->number()) : "");
+        "number", IntToString(field->number()));
   } else {
     GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter);
     printer->Print(
-        "public function get^camel_name^^field_number^()\n"
+        "public function get^camel_name^()\n"
         "{\n"
         "    return $this->^name^;\n"
         "}\n\n",
-        "camel_name", UnderscoresToCamelCase(field->name(), true),
-        "name", field->name(),
-        "field_number", need_other_name_for_accessor ?
-            StrCat(field->number()) : "");
+        "camel_name", UnderscoresToCamelCase(field->name(), true), "name",
+        field->name());
   }
 
   // For wrapper types, generate an additional getXXXValue getter
@@ -715,28 +684,21 @@
       field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
       IsWrapperType(field)) {
     GenerateWrapperFieldGetterDocComment(printer, field);
-
     printer->Print(
-        "public function get^camel_name^Value^field_number1^()\n"
+        "public function get^camel_name^Value()\n"
         "{\n"
-        "    $wrapper = $this->get^camel_name^^field_number2^();\n"
+        "    $wrapper = $this->get^camel_name^();\n"
         "    return is_null($wrapper) ? null : $wrapper->getValue();\n"
         "}\n\n",
-        "camel_name", UnderscoresToCamelCase(field->name(), true),
-        "field_number1", need_other_name_for_wrapper_accessor ?
-            StrCat(field->number()) : "",
-        "field_number2", need_other_name_for_accessor ?
-            StrCat(field->number()) : "");
+        "camel_name", UnderscoresToCamelCase(field->name(), true));
   }
 
   // Generate setter.
   GenerateFieldDocComment(printer, field, is_descriptor, kFieldSetter);
   printer->Print(
-      "public function set^camel_name^^field_number^($var)\n"
+      "public function set^camel_name^($var)\n"
       "{\n",
-      "camel_name", UnderscoresToCamelCase(field->name(), true),
-      "field_number", need_other_name_for_accessor ?
-          StrCat(field->number()) : "");
+      "camel_name", UnderscoresToCamelCase(field->name(), true));
 
   Indent(printer);
 
@@ -836,17 +798,13 @@
       IsWrapperType(field)) {
     GenerateWrapperFieldSetterDocComment(printer, field);
     printer->Print(
-        "public function set^camel_name^Value^field_number1^($var)\n"
+        "public function set^camel_name^Value($var)\n"
         "{\n"
         "    $wrappedVar = is_null($var) ? null : new \\^wrapper_type^(['value' => $var]);\n"
-        "    return $this->set^camel_name^^field_number2^($wrappedVar);\n"
+        "    return $this->set^camel_name^($wrappedVar);\n"
         "}\n\n",
         "camel_name", UnderscoresToCamelCase(field->name(), true),
-        "wrapper_type", LegacyFullClassName(field->message_type(), is_descriptor),
-        "field_number1", need_other_name_for_wrapper_accessor ?
-            StrCat(field->number()) : "",
-        "field_number2", need_other_name_for_accessor ?
-            StrCat(field->number()) : "");
+        "wrapper_type", LegacyFullClassName(field->message_type(), is_descriptor));
   }
 
   // Generate has method for proto2 only.