Browse Source

adds PHPDoc @return and @param for getters and setters respectively (#3131)

* adds PHPDoc @return and @param for getters and setters respectively

* addresses changes in PR review

* adds documentation tests

* Update php_generator:

- Prepend \ to names where required
- Remove <pre> tags
- Update protobuf field comments

* Updates class files with the protobuf changes

* Addresses review comments

* removes Protobuf Type line from PHP generated classes

* fixes phpdoc test

* adds array types to phpdoc
Brent Shaffer 8 years ago
parent
commit
12acbc2678
36 changed files with 1220 additions and 925 deletions
  1. 1 0
      Makefile.am
  2. 1 0
      php/phpunit.xml
  3. 61 39
      php/src/Google/Protobuf/Internal/DescriptorProto.php
  4. 13 7
      php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php
  5. 13 21
      php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php
  6. 19 12
      php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
  7. 19 28
      php/src/Google/Protobuf/Internal/EnumOptions.php
  8. 19 12
      php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php
  9. 13 19
      php/src/Google/Protobuf/Internal/EnumValueOptions.php
  10. 64 72
      php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
  11. 4 6
      php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
  12. 19 35
      php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
  13. 43 64
      php/src/Google/Protobuf/Internal/FieldOptions.php
  14. 4 6
      php/src/Google/Protobuf/Internal/FieldOptions_CType.php
  15. 4 10
      php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
  16. 73 87
      php/src/Google/Protobuf/Internal/FileDescriptorProto.php
  17. 7 6
      php/src/Google/Protobuf/Internal/FileDescriptorSet.php
  18. 109 145
      php/src/Google/Protobuf/Internal/FileOptions.php
  19. 4 12
      php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
  20. 7 12
      php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
  21. 25 37
      php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
  22. 34 49
      php/src/Google/Protobuf/Internal/MessageOptions.php
  23. 37 39
      php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
  24. 19 22
      php/src/Google/Protobuf/Internal/MethodOptions.php
  25. 4 10
      php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
  26. 13 9
      php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
  27. 7 10
      php/src/Google/Protobuf/Internal/OneofOptions.php
  28. 19 12
      php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
  29. 13 19
      php/src/Google/Protobuf/Internal/ServiceOptions.php
  30. 7 12
      php/src/Google/Protobuf/Internal/SourceCodeInfo.php
  31. 31 34
      php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
  32. 43 30
      php/src/Google/Protobuf/Internal/UninterpretedOption.php
  33. 13 9
      php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
  34. 337 0
      php/tests/generated_phpdoc_test.php
  35. 1 1
      php/tests/test.sh
  36. 120 39
      src/google/protobuf/compiler/php/php_generator.cc

+ 1 - 0
Makefile.am

@@ -658,6 +658,7 @@ php_EXTRA_DIST=                                                       \
   php/tests/encode_decode_test.php                                    \
   php/tests/gdb_test.sh                                               \
   php/tests/generated_class_test.php                                  \
+  php/tests/generated_phpdoc_test.php                                 \
   php/tests/map_field_test.php                                        \
   php/tests/memory_leak_test.php                                      \
   php/tests/php_implementation_test.php                               \

+ 1 - 0
php/phpunit.xml

@@ -7,6 +7,7 @@
       <file>tests/array_test.php</file>
       <file>tests/encode_decode_test.php</file>
       <file>tests/generated_class_test.php</file>
+      <file>tests/generated_phpdoc_test.php</file>
       <file>tests/map_field_test.php</file>
       <file>tests/well_known_test.php</file>
     </testsuite>

+ 61 - 39
php/src/Google/Protobuf/Internal/DescriptorProto.php

@@ -12,66 +12,62 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes a message type.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.DescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.DescriptorProto</code>
  */
 class DescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
      */
     private $field;
     private $has_field = false;
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
      */
     private $extension;
     private $has_extension = false;
     /**
-     * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
      */
     private $nested_type;
     private $has_nested_type = false;
     /**
-     * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
      */
     private $enum_type;
     private $has_enum_type = false;
     /**
-     * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
      */
     private $extension_range;
     private $has_extension_range = false;
     /**
-     * <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code>
      */
     private $oneof_decl;
     private $has_oneof_decl = false;
     /**
-     * <code>optional .google.protobuf.MessageOptions options = 7;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MessageOptions options = 7;</code>
      */
     private $options = null;
     private $has_options = false;
     /**
-     * <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
      */
     private $reserved_range;
     private $has_reserved_range = false;
     /**
-     * <pre>
      * Reserved field names, which may not be used by fields in the same message.
      * A given name may only be reserved once.
-     * </pre>
      *
-     * <code>repeated string reserved_name = 10;</code>
+     * Generated from protobuf field <code>repeated string reserved_name = 10;</code>
      */
     private $reserved_name;
     private $has_reserved_name = false;
@@ -82,7 +78,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -90,7 +87,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -107,7 +106,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getField()
     {
@@ -115,7 +115,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
+     * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setField(&$var)
     {
@@ -132,7 +134,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getExtension()
     {
@@ -140,7 +143,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
+     * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setExtension(&$var)
     {
@@ -157,7 +162,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getNestedType()
     {
@@ -165,7 +171,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
+     * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setNestedType(&$var)
     {
@@ -182,7 +190,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getEnumType()
     {
@@ -190,7 +199,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
+     * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setEnumType(&$var)
     {
@@ -207,7 +218,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getExtensionRange()
     {
@@ -215,7 +227,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
+     * @param \Google\Protobuf\Internal\DescriptorProto_ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setExtensionRange(&$var)
     {
@@ -232,7 +246,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getOneofDecl()
     {
@@ -240,7 +255,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code>
+     * @param \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setOneofDecl(&$var)
     {
@@ -257,7 +274,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.MessageOptions options = 7;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MessageOptions options = 7;</code>
+     * @return \Google\Protobuf\Internal\MessageOptions
      */
     public function getOptions()
     {
@@ -265,7 +283,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.MessageOptions options = 7;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MessageOptions options = 7;</code>
+     * @param \Google\Protobuf\Internal\MessageOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {
@@ -282,7 +302,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getReservedRange()
     {
@@ -290,7 +311,9 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
+     * @param \Google\Protobuf\Internal\DescriptorProto_ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setReservedRange(&$var)
     {
@@ -307,12 +330,11 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Reserved field names, which may not be used by fields in the same message.
      * A given name may only be reserved once.
-     * </pre>
      *
-     * <code>repeated string reserved_name = 10;</code>
+     * Generated from protobuf field <code>repeated string reserved_name = 10;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getReservedName()
     {
@@ -320,12 +342,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Reserved field names, which may not be used by fields in the same message.
      * A given name may only be reserved once.
-     * </pre>
      *
-     * <code>repeated string reserved_name = 10;</code>
+     * Generated from protobuf field <code>repeated string reserved_name = 10;</code>
+     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setReservedName(&$var)
     {

+ 13 - 7
php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php

@@ -12,17 +12,17 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.DescriptorProto.ExtensionRange</code>
+ * Generated from protobuf message <code>google.protobuf.DescriptorProto.ExtensionRange</code>
  */
 class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional int32 start = 1;</code>
+     * Generated from protobuf field <code>optional int32 start = 1;</code>
      */
     private $start = 0;
     private $has_start = false;
     /**
-     * <code>optional int32 end = 2;</code>
+     * Generated from protobuf field <code>optional int32 end = 2;</code>
      */
     private $end = 0;
     private $has_end = false;
@@ -33,7 +33,8 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 start = 1;</code>
+     * Generated from protobuf field <code>optional int32 start = 1;</code>
+     * @return int
      */
     public function getStart()
     {
@@ -41,7 +42,9 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 start = 1;</code>
+     * Generated from protobuf field <code>optional int32 start = 1;</code>
+     * @param int $var
+     * @return $this
      */
     public function setStart($var)
     {
@@ -58,7 +61,8 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 end = 2;</code>
+     * Generated from protobuf field <code>optional int32 end = 2;</code>
+     * @return int
      */
     public function getEnd()
     {
@@ -66,7 +70,9 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 end = 2;</code>
+     * Generated from protobuf field <code>optional int32 end = 2;</code>
+     * @param int $var
+     * @return $this
      */
     public function setEnd($var)
     {

+ 13 - 21
php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php

@@ -12,31 +12,25 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Range of reserved tag numbers. Reserved tag numbers may not be used by
  * fields or extension ranges in the same message. Reserved ranges may
  * not overlap.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.DescriptorProto.ReservedRange</code>
+ * Generated from protobuf message <code>google.protobuf.DescriptorProto.ReservedRange</code>
  */
 class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Inclusive.
-     * </pre>
      *
-     * <code>optional int32 start = 1;</code>
+     * Generated from protobuf field <code>optional int32 start = 1;</code>
      */
     private $start = 0;
     private $has_start = false;
     /**
-     * <pre>
      * Exclusive.
-     * </pre>
      *
-     * <code>optional int32 end = 2;</code>
+     * Generated from protobuf field <code>optional int32 end = 2;</code>
      */
     private $end = 0;
     private $has_end = false;
@@ -47,11 +41,10 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Inclusive.
-     * </pre>
      *
-     * <code>optional int32 start = 1;</code>
+     * Generated from protobuf field <code>optional int32 start = 1;</code>
+     * @return int
      */
     public function getStart()
     {
@@ -59,11 +52,11 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Inclusive.
-     * </pre>
      *
-     * <code>optional int32 start = 1;</code>
+     * Generated from protobuf field <code>optional int32 start = 1;</code>
+     * @param int $var
+     * @return $this
      */
     public function setStart($var)
     {
@@ -80,11 +73,10 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Exclusive.
-     * </pre>
      *
-     * <code>optional int32 end = 2;</code>
+     * Generated from protobuf field <code>optional int32 end = 2;</code>
+     * @return int
      */
     public function getEnd()
     {
@@ -92,11 +84,11 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Exclusive.
-     * </pre>
      *
-     * <code>optional int32 end = 2;</code>
+     * Generated from protobuf field <code>optional int32 end = 2;</code>
+     * @param int $var
+     * @return $this
      */
     public function setEnd($var)
     {

+ 19 - 12
php/src/Google/Protobuf/Internal/EnumDescriptorProto.php

@@ -12,26 +12,24 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes an enum type.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.EnumDescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.EnumDescriptorProto</code>
  */
 class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
      */
     private $value;
     private $has_value = false;
     /**
-     * <code>optional .google.protobuf.EnumOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
      */
     private $options = null;
     private $has_options = false;
@@ -42,7 +40,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -50,7 +49,9 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -67,7 +68,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getValue()
     {
@@ -75,7 +77,9 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
+     * @param \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setValue(&$var)
     {
@@ -92,7 +96,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.EnumOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
+     * @return \Google\Protobuf\Internal\EnumOptions
      */
     public function getOptions()
     {
@@ -100,7 +105,9 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.EnumOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.EnumOptions options = 3;</code>
+     * @param \Google\Protobuf\Internal\EnumOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {

+ 19 - 28
php/src/Google/Protobuf/Internal/EnumOptions.php

@@ -12,38 +12,32 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.EnumOptions</code>
+ * Generated from protobuf message <code>google.protobuf.EnumOptions</code>
  */
 class EnumOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Set this option to true to allow mapping different tag names to the same
      * value.
-     * </pre>
      *
-     * <code>optional bool allow_alias = 2;</code>
+     * Generated from protobuf field <code>optional bool allow_alias = 2;</code>
      */
     private $allow_alias = false;
     private $has_allow_alias = false;
     /**
-     * <pre>
      * Is this enum deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating enums.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
      */
     private $deprecated = false;
     private $has_deprecated = false;
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -54,12 +48,11 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Set this option to true to allow mapping different tag names to the same
      * value.
-     * </pre>
      *
-     * <code>optional bool allow_alias = 2;</code>
+     * Generated from protobuf field <code>optional bool allow_alias = 2;</code>
+     * @return bool
      */
     public function getAllowAlias()
     {
@@ -67,12 +60,12 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Set this option to true to allow mapping different tag names to the same
      * value.
-     * </pre>
      *
-     * <code>optional bool allow_alias = 2;</code>
+     * Generated from protobuf field <code>optional bool allow_alias = 2;</code>
+     * @param bool $var
+     * @return $this
      */
     public function setAllowAlias($var)
     {
@@ -89,14 +82,13 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this enum deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating enums.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
+     * @return bool
      */
     public function getDeprecated()
     {
@@ -104,14 +96,14 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this enum deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating enums.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setDeprecated($var)
     {
@@ -128,11 +120,10 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -140,11 +131,11 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 19 - 12
php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php

@@ -12,26 +12,24 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes a value within an enum.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.EnumValueDescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.EnumValueDescriptorProto</code>
  */
 class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <code>optional int32 number = 2;</code>
+     * Generated from protobuf field <code>optional int32 number = 2;</code>
      */
     private $number = 0;
     private $has_number = false;
     /**
-     * <code>optional .google.protobuf.EnumValueOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.EnumValueOptions options = 3;</code>
      */
     private $options = null;
     private $has_options = false;
@@ -42,7 +40,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -50,7 +49,9 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -67,7 +68,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 number = 2;</code>
+     * Generated from protobuf field <code>optional int32 number = 2;</code>
+     * @return int
      */
     public function getNumber()
     {
@@ -75,7 +77,9 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 number = 2;</code>
+     * Generated from protobuf field <code>optional int32 number = 2;</code>
+     * @param int $var
+     * @return $this
      */
     public function setNumber($var)
     {
@@ -92,7 +96,8 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.EnumValueOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.EnumValueOptions options = 3;</code>
+     * @return \Google\Protobuf\Internal\EnumValueOptions
      */
     public function getOptions()
     {
@@ -100,7 +105,9 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.EnumValueOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.EnumValueOptions options = 3;</code>
+     * @param \Google\Protobuf\Internal\EnumValueOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {

+ 13 - 19
php/src/Google/Protobuf/Internal/EnumValueOptions.php

@@ -12,28 +12,24 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.EnumValueOptions</code>
+ * Generated from protobuf message <code>google.protobuf.EnumValueOptions</code>
  */
 class EnumValueOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Is this enum value deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum value, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating enum values.
-     * </pre>
      *
-     * <code>optional bool deprecated = 1 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 1 [default = false];</code>
      */
     private $deprecated = false;
     private $has_deprecated = false;
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -44,14 +40,13 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this enum value deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum value, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating enum values.
-     * </pre>
      *
-     * <code>optional bool deprecated = 1 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 1 [default = false];</code>
+     * @return bool
      */
     public function getDeprecated()
     {
@@ -59,14 +54,14 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this enum value deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the enum value, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating enum values.
-     * </pre>
      *
-     * <code>optional bool deprecated = 1 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 1 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setDeprecated($var)
     {
@@ -83,11 +78,10 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -95,11 +89,11 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 64 - 72
php/src/Google/Protobuf/Internal/FieldDescriptorProto.php

@@ -12,99 +12,85 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes a field within a message.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.FieldDescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.FieldDescriptorProto</code>
  */
 class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <code>optional int32 number = 3;</code>
+     * Generated from protobuf field <code>optional int32 number = 3;</code>
      */
     private $number = 0;
     private $has_number = false;
     /**
-     * <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
      */
     private $label = 0;
     private $has_label = false;
     /**
-     * <pre>
      * If type_name is set, this need not be set.  If both this and type_name
      * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
      */
     private $type = 0;
     private $has_type = false;
     /**
-     * <pre>
      * For message and enum types, this is the name of the type.  If the name
      * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
      * rules are used to find the type (i.e. first the nested types within this
      * message are searched, then within the parent, on up to the root
      * namespace).
-     * </pre>
      *
-     * <code>optional string type_name = 6;</code>
+     * Generated from protobuf field <code>optional string type_name = 6;</code>
      */
     private $type_name = '';
     private $has_type_name = false;
     /**
-     * <pre>
      * For extensions, this is the name of the type being extended.  It is
      * resolved in the same manner as type_name.
-     * </pre>
      *
-     * <code>optional string extendee = 2;</code>
+     * Generated from protobuf field <code>optional string extendee = 2;</code>
      */
     private $extendee = '';
     private $has_extendee = false;
     /**
-     * <pre>
      * For numeric types, contains the original text representation of the value.
      * For booleans, "true" or "false".
      * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes &gt;= 128 are escaped.
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
      * TODO(kenton):  Base-64 encode?
-     * </pre>
      *
-     * <code>optional string default_value = 7;</code>
+     * Generated from protobuf field <code>optional string default_value = 7;</code>
      */
     private $default_value = '';
     private $has_default_value = false;
     /**
-     * <pre>
      * If set, gives the index of a oneof in the containing type's oneof_decl
      * list.  This field is a member of that oneof.
-     * </pre>
      *
-     * <code>optional int32 oneof_index = 9;</code>
+     * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
      */
     private $oneof_index = 0;
     private $has_oneof_index = false;
     /**
-     * <pre>
      * JSON name of this field. The value is set by protocol compiler. If the
      * user has set a "json_name" option on this field, that option's value
      * will be used. Otherwise, it's deduced from the field's name by converting
      * it to camelCase.
-     * </pre>
      *
-     * <code>optional string json_name = 10;</code>
+     * Generated from protobuf field <code>optional string json_name = 10;</code>
      */
     private $json_name = '';
     private $has_json_name = false;
     /**
-     * <code>optional .google.protobuf.FieldOptions options = 8;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
      */
     private $options = null;
     private $has_options = false;
@@ -115,7 +101,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -123,7 +110,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -140,7 +129,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 number = 3;</code>
+     * Generated from protobuf field <code>optional int32 number = 3;</code>
+     * @return int
      */
     public function getNumber()
     {
@@ -148,7 +138,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int32 number = 3;</code>
+     * Generated from protobuf field <code>optional int32 number = 3;</code>
+     * @param int $var
+     * @return $this
      */
     public function setNumber($var)
     {
@@ -165,7 +157,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
+     * @return int
      */
     public function getLabel()
     {
@@ -173,7 +166,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Label label = 4;</code>
+     * @param int $var
+     * @return $this
      */
     public function setLabel($var)
     {
@@ -190,12 +185,11 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If type_name is set, this need not be set.  If both this and type_name
      * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
+     * @return int
      */
     public function getType()
     {
@@ -203,12 +197,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If type_name is set, this need not be set.  If both this and type_name
      * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldDescriptorProto.Type type = 5;</code>
+     * @param int $var
+     * @return $this
      */
     public function setType($var)
     {
@@ -225,15 +219,14 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For message and enum types, this is the name of the type.  If the name
      * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
      * rules are used to find the type (i.e. first the nested types within this
      * message are searched, then within the parent, on up to the root
      * namespace).
-     * </pre>
      *
-     * <code>optional string type_name = 6;</code>
+     * Generated from protobuf field <code>optional string type_name = 6;</code>
+     * @return string
      */
     public function getTypeName()
     {
@@ -241,15 +234,15 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For message and enum types, this is the name of the type.  If the name
      * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
      * rules are used to find the type (i.e. first the nested types within this
      * message are searched, then within the parent, on up to the root
      * namespace).
-     * </pre>
      *
-     * <code>optional string type_name = 6;</code>
+     * Generated from protobuf field <code>optional string type_name = 6;</code>
+     * @param string $var
+     * @return $this
      */
     public function setTypeName($var)
     {
@@ -266,12 +259,11 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For extensions, this is the name of the type being extended.  It is
      * resolved in the same manner as type_name.
-     * </pre>
      *
-     * <code>optional string extendee = 2;</code>
+     * Generated from protobuf field <code>optional string extendee = 2;</code>
+     * @return string
      */
     public function getExtendee()
     {
@@ -279,12 +271,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For extensions, this is the name of the type being extended.  It is
      * resolved in the same manner as type_name.
-     * </pre>
      *
-     * <code>optional string extendee = 2;</code>
+     * Generated from protobuf field <code>optional string extendee = 2;</code>
+     * @param string $var
+     * @return $this
      */
     public function setExtendee($var)
     {
@@ -301,15 +293,14 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For numeric types, contains the original text representation of the value.
      * For booleans, "true" or "false".
      * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes &gt;= 128 are escaped.
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
      * TODO(kenton):  Base-64 encode?
-     * </pre>
      *
-     * <code>optional string default_value = 7;</code>
+     * Generated from protobuf field <code>optional string default_value = 7;</code>
+     * @return string
      */
     public function getDefaultValue()
     {
@@ -317,15 +308,15 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For numeric types, contains the original text representation of the value.
      * For booleans, "true" or "false".
      * For strings, contains the default text contents (not escaped in any way).
-     * For bytes, contains the C escaped value.  All bytes &gt;= 128 are escaped.
+     * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
      * TODO(kenton):  Base-64 encode?
-     * </pre>
      *
-     * <code>optional string default_value = 7;</code>
+     * Generated from protobuf field <code>optional string default_value = 7;</code>
+     * @param string $var
+     * @return $this
      */
     public function setDefaultValue($var)
     {
@@ -342,12 +333,11 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set, gives the index of a oneof in the containing type's oneof_decl
      * list.  This field is a member of that oneof.
-     * </pre>
      *
-     * <code>optional int32 oneof_index = 9;</code>
+     * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
+     * @return int
      */
     public function getOneofIndex()
     {
@@ -355,12 +345,12 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set, gives the index of a oneof in the containing type's oneof_decl
      * list.  This field is a member of that oneof.
-     * </pre>
      *
-     * <code>optional int32 oneof_index = 9;</code>
+     * Generated from protobuf field <code>optional int32 oneof_index = 9;</code>
+     * @param int $var
+     * @return $this
      */
     public function setOneofIndex($var)
     {
@@ -377,14 +367,13 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * JSON name of this field. The value is set by protocol compiler. If the
      * user has set a "json_name" option on this field, that option's value
      * will be used. Otherwise, it's deduced from the field's name by converting
      * it to camelCase.
-     * </pre>
      *
-     * <code>optional string json_name = 10;</code>
+     * Generated from protobuf field <code>optional string json_name = 10;</code>
+     * @return string
      */
     public function getJsonName()
     {
@@ -392,14 +381,14 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * JSON name of this field. The value is set by protocol compiler. If the
      * user has set a "json_name" option on this field, that option's value
      * will be used. Otherwise, it's deduced from the field's name by converting
      * it to camelCase.
-     * </pre>
      *
-     * <code>optional string json_name = 10;</code>
+     * Generated from protobuf field <code>optional string json_name = 10;</code>
+     * @param string $var
+     * @return $this
      */
     public function setJsonName($var)
     {
@@ -416,7 +405,8 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FieldOptions options = 8;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
+     * @return \Google\Protobuf\Internal\FieldOptions
      */
     public function getOptions()
     {
@@ -424,7 +414,9 @@ class FieldDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FieldOptions options = 8;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions options = 8;</code>
+     * @param \Google\Protobuf\Internal\FieldOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {

+ 4 - 6
php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php

@@ -5,24 +5,22 @@
 namespace Google\Protobuf\Internal;
 
 /**
- * Protobuf enum <code>google.protobuf.FieldDescriptorProto.Label</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
  */
 class FieldDescriptorProto_Label
 {
     /**
-     * <pre>
      * 0 is reserved for errors
-     * </pre>
      *
-     * <code>LABEL_OPTIONAL = 1;</code>
+     * Generated from protobuf enum <code>LABEL_OPTIONAL = 1;</code>
      */
     const LABEL_OPTIONAL = 1;
     /**
-     * <code>LABEL_REQUIRED = 2;</code>
+     * Generated from protobuf enum <code>LABEL_REQUIRED = 2;</code>
      */
     const LABEL_REQUIRED = 2;
     /**
-     * <code>LABEL_REPEATED = 3;</code>
+     * Generated from protobuf enum <code>LABEL_REPEATED = 3;</code>
      */
     const LABEL_REPEATED = 3;
 }

+ 19 - 35
php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php

@@ -5,118 +5,102 @@
 namespace Google\Protobuf\Internal;
 
 /**
- * Protobuf enum <code>google.protobuf.FieldDescriptorProto.Type</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
  */
 class FieldDescriptorProto_Type
 {
     /**
-     * <pre>
      * 0 is reserved for errors.
      * Order is weird for historical reasons.
-     * </pre>
      *
-     * <code>TYPE_DOUBLE = 1;</code>
+     * Generated from protobuf enum <code>TYPE_DOUBLE = 1;</code>
      */
     const TYPE_DOUBLE = 1;
     /**
-     * <code>TYPE_FLOAT = 2;</code>
+     * Generated from protobuf enum <code>TYPE_FLOAT = 2;</code>
      */
     const TYPE_FLOAT = 2;
     /**
-     * <pre>
      * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT64 if
      * negative values are likely.
-     * </pre>
      *
-     * <code>TYPE_INT64 = 3;</code>
+     * Generated from protobuf enum <code>TYPE_INT64 = 3;</code>
      */
     const TYPE_INT64 = 3;
     /**
-     * <code>TYPE_UINT64 = 4;</code>
+     * Generated from protobuf enum <code>TYPE_UINT64 = 4;</code>
      */
     const TYPE_UINT64 = 4;
     /**
-     * <pre>
      * Not ZigZag encoded.  Negative numbers take 10 bytes.  Use TYPE_SINT32 if
      * negative values are likely.
-     * </pre>
      *
-     * <code>TYPE_INT32 = 5;</code>
+     * Generated from protobuf enum <code>TYPE_INT32 = 5;</code>
      */
     const TYPE_INT32 = 5;
     /**
-     * <code>TYPE_FIXED64 = 6;</code>
+     * Generated from protobuf enum <code>TYPE_FIXED64 = 6;</code>
      */
     const TYPE_FIXED64 = 6;
     /**
-     * <code>TYPE_FIXED32 = 7;</code>
+     * Generated from protobuf enum <code>TYPE_FIXED32 = 7;</code>
      */
     const TYPE_FIXED32 = 7;
     /**
-     * <code>TYPE_BOOL = 8;</code>
+     * Generated from protobuf enum <code>TYPE_BOOL = 8;</code>
      */
     const TYPE_BOOL = 8;
     /**
-     * <code>TYPE_STRING = 9;</code>
+     * Generated from protobuf enum <code>TYPE_STRING = 9;</code>
      */
     const TYPE_STRING = 9;
     /**
-     * <pre>
      * Tag-delimited aggregate.
      * Group type is deprecated and not supported in proto3. However, Proto3
      * implementations should still be able to parse the group wire format and
      * treat group fields as unknown fields.
-     * </pre>
      *
-     * <code>TYPE_GROUP = 10;</code>
+     * Generated from protobuf enum <code>TYPE_GROUP = 10;</code>
      */
     const TYPE_GROUP = 10;
     /**
-     * <pre>
      * Length-delimited aggregate.
-     * </pre>
      *
-     * <code>TYPE_MESSAGE = 11;</code>
+     * Generated from protobuf enum <code>TYPE_MESSAGE = 11;</code>
      */
     const TYPE_MESSAGE = 11;
     /**
-     * <pre>
      * New in version 2.
-     * </pre>
      *
-     * <code>TYPE_BYTES = 12;</code>
+     * Generated from protobuf enum <code>TYPE_BYTES = 12;</code>
      */
     const TYPE_BYTES = 12;
     /**
-     * <code>TYPE_UINT32 = 13;</code>
+     * Generated from protobuf enum <code>TYPE_UINT32 = 13;</code>
      */
     const TYPE_UINT32 = 13;
     /**
-     * <code>TYPE_ENUM = 14;</code>
+     * Generated from protobuf enum <code>TYPE_ENUM = 14;</code>
      */
     const TYPE_ENUM = 14;
     /**
-     * <code>TYPE_SFIXED32 = 15;</code>
+     * Generated from protobuf enum <code>TYPE_SFIXED32 = 15;</code>
      */
     const TYPE_SFIXED32 = 15;
     /**
-     * <code>TYPE_SFIXED64 = 16;</code>
+     * Generated from protobuf enum <code>TYPE_SFIXED64 = 16;</code>
      */
     const TYPE_SFIXED64 = 16;
     /**
-     * <pre>
      * Uses ZigZag encoding.
-     * </pre>
      *
-     * <code>TYPE_SINT32 = 17;</code>
+     * Generated from protobuf enum <code>TYPE_SINT32 = 17;</code>
      */
     const TYPE_SINT32 = 17;
     /**
-     * <pre>
      * Uses ZigZag encoding.
-     * </pre>
      *
-     * <code>TYPE_SINT64 = 18;</code>
+     * Generated from protobuf enum <code>TYPE_SINT64 = 18;</code>
      */
     const TYPE_SINT64 = 18;
 }

+ 43 - 64
php/src/Google/Protobuf/Internal/FieldOptions.php

@@ -12,37 +12,32 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.FieldOptions</code>
+ * Generated from protobuf message <code>google.protobuf.FieldOptions</code>
  */
 class FieldOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * The ctype option instructs the C++ code generator to use a different
      * representation of the field than it normally would.  See the specific
      * options below.  This option is not yet implemented in the open source
      * release -- sorry, we'll try to include it in a future version!
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
      */
     private $ctype = 0;
     private $has_ctype = false;
     /**
-     * <pre>
      * The packed option can be enabled for repeated primitive fields to enable
      * a more efficient representation on the wire. Rather than repeatedly
      * writing the tag and type for each element, the entire array is encoded as
      * a single length-delimited blob. In proto3, only explicit setting it to
      * false will avoid using packed encoding.
-     * </pre>
      *
-     * <code>optional bool packed = 2;</code>
+     * Generated from protobuf field <code>optional bool packed = 2;</code>
      */
     private $packed = false;
     private $has_packed = false;
     /**
-     * <pre>
      * The jstype option determines the JavaScript type used for values of the
      * field.  The option is permitted only for 64 bit integral and fixed types
      * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
@@ -52,14 +47,12 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * JavaScript code to use the JavaScript "number" type instead of strings.
      * This option is an enum to permit additional types to be added,
      * e.g. goog.math.Integer.
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
      */
     private $jstype = 0;
     private $has_jstype = false;
     /**
-     * <pre>
      * Should this field be parsed lazily?  Lazy applies only to message-type
      * fields.  It means that when the outer message is initially parsed, the
      * inner message's contents will not be parsed but instead stored in encoded
@@ -84,39 +77,32 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * implementation must either *always* check its required fields, or *never*
      * check its required fields, regardless of whether or not the message has
      * been parsed.
-     * </pre>
      *
-     * <code>optional bool lazy = 5 [default = false];</code>
+     * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
      */
     private $lazy = false;
     private $has_lazy = false;
     /**
-     * <pre>
      * Is this field deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for accessors, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating fields.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
      */
     private $deprecated = false;
     private $has_deprecated = false;
     /**
-     * <pre>
      * For Google-internal migration only. Do not use.
-     * </pre>
      *
-     * <code>optional bool weak = 10 [default = false];</code>
+     * Generated from protobuf field <code>optional bool weak = 10 [default = false];</code>
      */
     private $weak = false;
     private $has_weak = false;
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -127,14 +113,13 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The ctype option instructs the C++ code generator to use a different
      * representation of the field than it normally would.  See the specific
      * options below.  This option is not yet implemented in the open source
      * release -- sorry, we'll try to include it in a future version!
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
+     * @return int
      */
     public function getCtype()
     {
@@ -142,14 +127,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The ctype option instructs the C++ code generator to use a different
      * representation of the field than it normally would.  See the specific
      * options below.  This option is not yet implemented in the open source
      * release -- sorry, we'll try to include it in a future version!
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];</code>
+     * @param int $var
+     * @return $this
      */
     public function setCtype($var)
     {
@@ -166,15 +151,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The packed option can be enabled for repeated primitive fields to enable
      * a more efficient representation on the wire. Rather than repeatedly
      * writing the tag and type for each element, the entire array is encoded as
      * a single length-delimited blob. In proto3, only explicit setting it to
      * false will avoid using packed encoding.
-     * </pre>
      *
-     * <code>optional bool packed = 2;</code>
+     * Generated from protobuf field <code>optional bool packed = 2;</code>
+     * @return bool
      */
     public function getPacked()
     {
@@ -182,15 +166,15 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The packed option can be enabled for repeated primitive fields to enable
      * a more efficient representation on the wire. Rather than repeatedly
      * writing the tag and type for each element, the entire array is encoded as
      * a single length-delimited blob. In proto3, only explicit setting it to
      * false will avoid using packed encoding.
-     * </pre>
      *
-     * <code>optional bool packed = 2;</code>
+     * Generated from protobuf field <code>optional bool packed = 2;</code>
+     * @param bool $var
+     * @return $this
      */
     public function setPacked($var)
     {
@@ -207,7 +191,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The jstype option determines the JavaScript type used for values of the
      * field.  The option is permitted only for 64 bit integral and fixed types
      * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
@@ -217,9 +200,9 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * JavaScript code to use the JavaScript "number" type instead of strings.
      * This option is an enum to permit additional types to be added,
      * e.g. goog.math.Integer.
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
+     * @return int
      */
     public function getJstype()
     {
@@ -227,7 +210,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The jstype option determines the JavaScript type used for values of the
      * field.  The option is permitted only for 64 bit integral and fixed types
      * (int64, uint64, sint64, fixed64, sfixed64).  By default these types are
@@ -237,9 +219,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * JavaScript code to use the JavaScript "number" type instead of strings.
      * This option is an enum to permit additional types to be added,
      * e.g. goog.math.Integer.
-     * </pre>
      *
-     * <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code>
+     * @param int $var
+     * @return $this
      */
     public function setJstype($var)
     {
@@ -256,7 +239,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Should this field be parsed lazily?  Lazy applies only to message-type
      * fields.  It means that when the outer message is initially parsed, the
      * inner message's contents will not be parsed but instead stored in encoded
@@ -281,9 +263,9 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * implementation must either *always* check its required fields, or *never*
      * check its required fields, regardless of whether or not the message has
      * been parsed.
-     * </pre>
      *
-     * <code>optional bool lazy = 5 [default = false];</code>
+     * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
+     * @return bool
      */
     public function getLazy()
     {
@@ -291,7 +273,6 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Should this field be parsed lazily?  Lazy applies only to message-type
      * fields.  It means that when the outer message is initially parsed, the
      * inner message's contents will not be parsed but instead stored in encoded
@@ -316,9 +297,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
      * implementation must either *always* check its required fields, or *never*
      * check its required fields, regardless of whether or not the message has
      * been parsed.
-     * </pre>
      *
-     * <code>optional bool lazy = 5 [default = false];</code>
+     * Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setLazy($var)
     {
@@ -335,14 +317,13 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this field deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for accessors, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating fields.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
+     * @return bool
      */
     public function getDeprecated()
     {
@@ -350,14 +331,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this field deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for accessors, or it will be completely ignored; in the very least, this
      * is a formalization for deprecating fields.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setDeprecated($var)
     {
@@ -374,11 +355,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For Google-internal migration only. Do not use.
-     * </pre>
      *
-     * <code>optional bool weak = 10 [default = false];</code>
+     * Generated from protobuf field <code>optional bool weak = 10 [default = false];</code>
+     * @return bool
      */
     public function getWeak()
     {
@@ -386,11 +366,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * For Google-internal migration only. Do not use.
-     * </pre>
      *
-     * <code>optional bool weak = 10 [default = false];</code>
+     * Generated from protobuf field <code>optional bool weak = 10 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setWeak($var)
     {
@@ -407,11 +387,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -419,11 +398,11 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 4 - 6
php/src/Google/Protobuf/Internal/FieldOptions_CType.php

@@ -5,24 +5,22 @@
 namespace Google\Protobuf\Internal;
 
 /**
- * Protobuf enum <code>google.protobuf.FieldOptions.CType</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
  */
 class FieldOptions_CType
 {
     /**
-     * <pre>
      * Default mode.
-     * </pre>
      *
-     * <code>STRING = 0;</code>
+     * Generated from protobuf enum <code>STRING = 0;</code>
      */
     const STRING = 0;
     /**
-     * <code>CORD = 1;</code>
+     * Generated from protobuf enum <code>CORD = 1;</code>
      */
     const CORD = 1;
     /**
-     * <code>STRING_PIECE = 2;</code>
+     * Generated from protobuf enum <code>STRING_PIECE = 2;</code>
      */
     const STRING_PIECE = 2;
 }

+ 4 - 10
php/src/Google/Protobuf/Internal/FieldOptions_JSType.php

@@ -5,32 +5,26 @@
 namespace Google\Protobuf\Internal;
 
 /**
- * Protobuf enum <code>google.protobuf.FieldOptions.JSType</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
  */
 class FieldOptions_JSType
 {
     /**
-     * <pre>
      * Use the default type.
-     * </pre>
      *
-     * <code>JS_NORMAL = 0;</code>
+     * Generated from protobuf enum <code>JS_NORMAL = 0;</code>
      */
     const JS_NORMAL = 0;
     /**
-     * <pre>
      * Use JavaScript strings.
-     * </pre>
      *
-     * <code>JS_STRING = 1;</code>
+     * Generated from protobuf enum <code>JS_STRING = 1;</code>
      */
     const JS_STRING = 1;
     /**
-     * <pre>
      * Use JavaScript numbers.
-     * </pre>
      *
-     * <code>JS_NUMBER = 2;</code>
+     * Generated from protobuf enum <code>JS_NUMBER = 2;</code>
      */
     const JS_NUMBER = 2;
 }

+ 73 - 87
php/src/Google/Protobuf/Internal/FileDescriptorProto.php

@@ -12,108 +12,90 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes a complete .proto file.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.FileDescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.FileDescriptorProto</code>
  */
 class FileDescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * file name, relative to root of source tree
-     * </pre>
      *
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <pre>
      * e.g. "foo", "foo.bar", etc.
-     * </pre>
      *
-     * <code>optional string package = 2;</code>
+     * Generated from protobuf field <code>optional string package = 2;</code>
      */
     private $package = '';
     private $has_package = false;
     /**
-     * <pre>
      * Names of files imported by this file.
-     * </pre>
      *
-     * <code>repeated string dependency = 3;</code>
+     * Generated from protobuf field <code>repeated string dependency = 3;</code>
      */
     private $dependency;
     private $has_dependency = false;
     /**
-     * <pre>
      * Indexes of the public imported files in the dependency list above.
-     * </pre>
      *
-     * <code>repeated int32 public_dependency = 10;</code>
+     * Generated from protobuf field <code>repeated int32 public_dependency = 10;</code>
      */
     private $public_dependency;
     private $has_public_dependency = false;
     /**
-     * <pre>
      * Indexes of the weak imported files in the dependency list.
      * For Google-internal migration only. Do not use.
-     * </pre>
      *
-     * <code>repeated int32 weak_dependency = 11;</code>
+     * Generated from protobuf field <code>repeated int32 weak_dependency = 11;</code>
      */
     private $weak_dependency;
     private $has_weak_dependency = false;
     /**
-     * <pre>
      * All top-level definitions in this file.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
      */
     private $message_type;
     private $has_message_type = false;
     /**
-     * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
      */
     private $enum_type;
     private $has_enum_type = false;
     /**
-     * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
      */
     private $service;
     private $has_service = false;
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
      */
     private $extension;
     private $has_extension = false;
     /**
-     * <code>optional .google.protobuf.FileOptions options = 8;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FileOptions options = 8;</code>
      */
     private $options = null;
     private $has_options = false;
     /**
-     * <pre>
      * This field contains optional information about the original source code.
      * You may safely remove this entire field without harming runtime
      * functionality of the descriptors -- the information is needed only by
      * development tools.
-     * </pre>
      *
-     * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
      */
     private $source_code_info = null;
     private $has_source_code_info = false;
     /**
-     * <pre>
      * The syntax of the proto file.
      * The supported values are "proto2" and "proto3".
-     * </pre>
      *
-     * <code>optional string syntax = 12;</code>
+     * Generated from protobuf field <code>optional string syntax = 12;</code>
      */
     private $syntax = '';
     private $has_syntax = false;
@@ -124,11 +106,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * file name, relative to root of source tree
-     * </pre>
      *
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -136,11 +117,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * file name, relative to root of source tree
-     * </pre>
      *
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -157,11 +138,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * e.g. "foo", "foo.bar", etc.
-     * </pre>
      *
-     * <code>optional string package = 2;</code>
+     * Generated from protobuf field <code>optional string package = 2;</code>
+     * @return string
      */
     public function getPackage()
     {
@@ -169,11 +149,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * e.g. "foo", "foo.bar", etc.
-     * </pre>
      *
-     * <code>optional string package = 2;</code>
+     * Generated from protobuf field <code>optional string package = 2;</code>
+     * @param string $var
+     * @return $this
      */
     public function setPackage($var)
     {
@@ -190,11 +170,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Names of files imported by this file.
-     * </pre>
      *
-     * <code>repeated string dependency = 3;</code>
+     * Generated from protobuf field <code>repeated string dependency = 3;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getDependency()
     {
@@ -202,11 +181,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Names of files imported by this file.
-     * </pre>
      *
-     * <code>repeated string dependency = 3;</code>
+     * Generated from protobuf field <code>repeated string dependency = 3;</code>
+     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setDependency(&$var)
     {
@@ -223,11 +202,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Indexes of the public imported files in the dependency list above.
-     * </pre>
      *
-     * <code>repeated int32 public_dependency = 10;</code>
+     * Generated from protobuf field <code>repeated int32 public_dependency = 10;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getPublicDependency()
     {
@@ -235,11 +213,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Indexes of the public imported files in the dependency list above.
-     * </pre>
      *
-     * <code>repeated int32 public_dependency = 10;</code>
+     * Generated from protobuf field <code>repeated int32 public_dependency = 10;</code>
+     * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setPublicDependency(&$var)
     {
@@ -256,12 +234,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Indexes of the weak imported files in the dependency list.
      * For Google-internal migration only. Do not use.
-     * </pre>
      *
-     * <code>repeated int32 weak_dependency = 11;</code>
+     * Generated from protobuf field <code>repeated int32 weak_dependency = 11;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getWeakDependency()
     {
@@ -269,12 +246,12 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Indexes of the weak imported files in the dependency list.
      * For Google-internal migration only. Do not use.
-     * </pre>
      *
-     * <code>repeated int32 weak_dependency = 11;</code>
+     * Generated from protobuf field <code>repeated int32 weak_dependency = 11;</code>
+     * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setWeakDependency(&$var)
     {
@@ -291,11 +268,10 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * All top-level definitions in this file.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getMessageType()
     {
@@ -303,11 +279,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * All top-level definitions in this file.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
+     * @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setMessageType(&$var)
     {
@@ -324,7 +300,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getEnumType()
     {
@@ -332,7 +309,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
+     * @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setEnumType(&$var)
     {
@@ -349,7 +328,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getService()
     {
@@ -357,7 +337,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
+     * @param \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setService(&$var)
     {
@@ -374,7 +356,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getExtension()
     {
@@ -382,7 +365,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
+     * @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setExtension(&$var)
     {
@@ -399,7 +384,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FileOptions options = 8;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FileOptions options = 8;</code>
+     * @return \Google\Protobuf\Internal\FileOptions
      */
     public function getOptions()
     {
@@ -407,7 +393,9 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FileOptions options = 8;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FileOptions options = 8;</code>
+     * @param \Google\Protobuf\Internal\FileOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {
@@ -424,14 +412,13 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * This field contains optional information about the original source code.
      * You may safely remove this entire field without harming runtime
      * functionality of the descriptors -- the information is needed only by
      * development tools.
-     * </pre>
      *
-     * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
+     * @return \Google\Protobuf\Internal\SourceCodeInfo
      */
     public function getSourceCodeInfo()
     {
@@ -439,14 +426,14 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * This field contains optional information about the original source code.
      * You may safely remove this entire field without harming runtime
      * functionality of the descriptors -- the information is needed only by
      * development tools.
-     * </pre>
      *
-     * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
+     * @param \Google\Protobuf\Internal\SourceCodeInfo $var
+     * @return $this
      */
     public function setSourceCodeInfo(&$var)
     {
@@ -463,12 +450,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The syntax of the proto file.
      * The supported values are "proto2" and "proto3".
-     * </pre>
      *
-     * <code>optional string syntax = 12;</code>
+     * Generated from protobuf field <code>optional string syntax = 12;</code>
+     * @return string
      */
     public function getSyntax()
     {
@@ -476,12 +462,12 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The syntax of the proto file.
      * The supported values are "proto2" and "proto3".
-     * </pre>
      *
-     * <code>optional string syntax = 12;</code>
+     * Generated from protobuf field <code>optional string syntax = 12;</code>
+     * @param string $var
+     * @return $this
      */
     public function setSyntax($var)
     {

+ 7 - 6
php/src/Google/Protobuf/Internal/FileDescriptorSet.php

@@ -12,17 +12,15 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * The protocol compiler can output a FileDescriptorSet containing the .proto
  * files it parses.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.FileDescriptorSet</code>
+ * Generated from protobuf message <code>google.protobuf.FileDescriptorSet</code>
  */
 class FileDescriptorSet extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
      */
     private $file;
     private $has_file = false;
@@ -33,7 +31,8 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getFile()
     {
@@ -41,7 +40,9 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
+     * @param \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setFile(&$var)
     {

+ 109 - 145
php/src/Google/Protobuf/Internal/FileOptions.php

@@ -12,92 +12,79 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.FileOptions</code>
+ * Generated from protobuf message <code>google.protobuf.FileOptions</code>
  */
 class FileOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Sets the Java package where classes generated from this .proto will be
      * placed.  By default, the proto package is used, but this is often
      * inappropriate because proto packages do not normally start with backwards
      * domain names.
-     * </pre>
      *
-     * <code>optional string java_package = 1;</code>
+     * Generated from protobuf field <code>optional string java_package = 1;</code>
      */
     private $java_package = '';
     private $has_java_package = false;
     /**
-     * <pre>
      * If set, all the classes from the .proto file are wrapped in a single
      * outer class with the given name.  This applies to both Proto1
      * (equivalent to the old "--one_java_file" option) and Proto2 (where
      * a .proto always translates to a single class, but you may want to
      * explicitly choose the class name).
-     * </pre>
      *
-     * <code>optional string java_outer_classname = 8;</code>
+     * Generated from protobuf field <code>optional string java_outer_classname = 8;</code>
      */
     private $java_outer_classname = '';
     private $has_java_outer_classname = false;
     /**
-     * <pre>
      * If set true, then the Java code generator will generate a separate .java
      * file for each top-level message, enum, and service defined in the .proto
      * file.  Thus, these types will *not* be nested inside the outer class
      * named by java_outer_classname.  However, the outer class will still be
      * generated to contain the file's getDescriptor() method as well as any
      * top-level extensions defined in the file.
-     * </pre>
      *
-     * <code>optional bool java_multiple_files = 10 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_multiple_files = 10 [default = false];</code>
      */
     private $java_multiple_files = false;
     private $has_java_multiple_files = false;
     /**
-     * <pre>
      * This option does nothing.
-     * </pre>
      *
-     * <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code>
+     * Generated from protobuf field <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code>
      */
     private $java_generate_equals_and_hash = false;
     private $has_java_generate_equals_and_hash = false;
     /**
-     * <pre>
      * If set true, then the Java2 code generator will generate code that
      * throws an exception whenever an attempt is made to assign a non-UTF-8
      * byte sequence to a string field.
      * Message reflection will do the same.
      * However, an extension field still accepts non-UTF-8 byte sequences.
      * This option has no effect on when used with the lite runtime.
-     * </pre>
      *
-     * <code>optional bool java_string_check_utf8 = 27 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_string_check_utf8 = 27 [default = false];</code>
      */
     private $java_string_check_utf8 = false;
     private $has_java_string_check_utf8 = false;
     /**
-     * <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code>
      */
     private $optimize_for = 0;
     private $has_optimize_for = false;
     /**
-     * <pre>
      * Sets the Go package where structs generated from this .proto will be
      * placed. If omitted, the Go package will be derived from the following:
      *   - The basename of the package import path, if provided.
      *   - Otherwise, the package statement in the .proto file, if present.
      *   - Otherwise, the basename of the .proto file, without extension.
-     * </pre>
      *
-     * <code>optional string go_package = 11;</code>
+     * Generated from protobuf field <code>optional string go_package = 11;</code>
      */
     private $go_package = '';
     private $has_go_package = false;
     /**
-     * <pre>
      * Should generic services be generated in each language?  "Generic" services
      * are not specific to any particular RPC system.  They are generated by the
      * main code generators in each language (without additional plugins).
@@ -107,102 +94,85 @@ class FileOptions extends \Google\Protobuf\Internal\Message
      * that generate code specific to your particular RPC system.  Therefore,
      * these default to false.  Old code which depends on generic services should
      * explicitly set them to true.
-     * </pre>
      *
-     * <code>optional bool cc_generic_services = 16 [default = false];</code>
+     * Generated from protobuf field <code>optional bool cc_generic_services = 16 [default = false];</code>
      */
     private $cc_generic_services = false;
     private $has_cc_generic_services = false;
     /**
-     * <code>optional bool java_generic_services = 17 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_generic_services = 17 [default = false];</code>
      */
     private $java_generic_services = false;
     private $has_java_generic_services = false;
     /**
-     * <code>optional bool py_generic_services = 18 [default = false];</code>
+     * Generated from protobuf field <code>optional bool py_generic_services = 18 [default = false];</code>
      */
     private $py_generic_services = false;
     private $has_py_generic_services = false;
     /**
-     * <pre>
      * Is this file deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for everything in the file, or it will be completely ignored; in the very
      * least, this is a formalization for deprecating files.
-     * </pre>
      *
-     * <code>optional bool deprecated = 23 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 23 [default = false];</code>
      */
     private $deprecated = false;
     private $has_deprecated = false;
     /**
-     * <pre>
      * Enables the use of arenas for the proto messages in this file. This applies
      * only to generated classes for C++.
-     * </pre>
      *
-     * <code>optional bool cc_enable_arenas = 31 [default = false];</code>
+     * Generated from protobuf field <code>optional bool cc_enable_arenas = 31 [default = false];</code>
      */
     private $cc_enable_arenas = false;
     private $has_cc_enable_arenas = false;
     /**
-     * <pre>
      * Sets the objective c class prefix which is prepended to all objective c
      * generated classes from this .proto. There is no default.
-     * </pre>
      *
-     * <code>optional string objc_class_prefix = 36;</code>
+     * Generated from protobuf field <code>optional string objc_class_prefix = 36;</code>
      */
     private $objc_class_prefix = '';
     private $has_objc_class_prefix = false;
     /**
-     * <pre>
      * Namespace for generated classes; defaults to the package.
-     * </pre>
      *
-     * <code>optional string csharp_namespace = 37;</code>
+     * Generated from protobuf field <code>optional string csharp_namespace = 37;</code>
      */
     private $csharp_namespace = '';
     private $has_csharp_namespace = false;
     /**
-     * <pre>
      * By default Swift generators will take the proto package and CamelCase it
      * replacing '.' with underscore and use that to prefix the types/symbols
      * defined. When this options is provided, they will use this value instead
      * to prefix the types/symbols defined.
-     * </pre>
      *
-     * <code>optional string swift_prefix = 39;</code>
+     * Generated from protobuf field <code>optional string swift_prefix = 39;</code>
      */
     private $swift_prefix = '';
     private $has_swift_prefix = false;
     /**
-     * <pre>
      * Sets the php class prefix which is prepended to all php generated classes
      * from this .proto. Default is empty.
-     * </pre>
      *
-     * <code>optional string php_class_prefix = 40;</code>
+     * Generated from protobuf field <code>optional string php_class_prefix = 40;</code>
      */
     private $php_class_prefix = '';
     private $has_php_class_prefix = false;
     /**
-     * <pre>
      * Use this option to change the namespace of php generated classes. Default
      * is empty. When this option is empty, the package name will be used for
      * determining the namespace.
-     * </pre>
      *
-     * <code>optional string php_namespace = 41;</code>
+     * Generated from protobuf field <code>optional string php_namespace = 41;</code>
      */
     private $php_namespace = '';
     private $has_php_namespace = false;
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -213,14 +183,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the Java package where classes generated from this .proto will be
      * placed.  By default, the proto package is used, but this is often
      * inappropriate because proto packages do not normally start with backwards
      * domain names.
-     * </pre>
      *
-     * <code>optional string java_package = 1;</code>
+     * Generated from protobuf field <code>optional string java_package = 1;</code>
+     * @return string
      */
     public function getJavaPackage()
     {
@@ -228,14 +197,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the Java package where classes generated from this .proto will be
      * placed.  By default, the proto package is used, but this is often
      * inappropriate because proto packages do not normally start with backwards
      * domain names.
-     * </pre>
      *
-     * <code>optional string java_package = 1;</code>
+     * Generated from protobuf field <code>optional string java_package = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setJavaPackage($var)
     {
@@ -252,15 +221,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set, all the classes from the .proto file are wrapped in a single
      * outer class with the given name.  This applies to both Proto1
      * (equivalent to the old "--one_java_file" option) and Proto2 (where
      * a .proto always translates to a single class, but you may want to
      * explicitly choose the class name).
-     * </pre>
      *
-     * <code>optional string java_outer_classname = 8;</code>
+     * Generated from protobuf field <code>optional string java_outer_classname = 8;</code>
+     * @return string
      */
     public function getJavaOuterClassname()
     {
@@ -268,15 +236,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set, all the classes from the .proto file are wrapped in a single
      * outer class with the given name.  This applies to both Proto1
      * (equivalent to the old "--one_java_file" option) and Proto2 (where
      * a .proto always translates to a single class, but you may want to
      * explicitly choose the class name).
-     * </pre>
      *
-     * <code>optional string java_outer_classname = 8;</code>
+     * Generated from protobuf field <code>optional string java_outer_classname = 8;</code>
+     * @param string $var
+     * @return $this
      */
     public function setJavaOuterClassname($var)
     {
@@ -293,16 +261,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set true, then the Java code generator will generate a separate .java
      * file for each top-level message, enum, and service defined in the .proto
      * file.  Thus, these types will *not* be nested inside the outer class
      * named by java_outer_classname.  However, the outer class will still be
      * generated to contain the file's getDescriptor() method as well as any
      * top-level extensions defined in the file.
-     * </pre>
      *
-     * <code>optional bool java_multiple_files = 10 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_multiple_files = 10 [default = false];</code>
+     * @return bool
      */
     public function getJavaMultipleFiles()
     {
@@ -310,16 +277,16 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set true, then the Java code generator will generate a separate .java
      * file for each top-level message, enum, and service defined in the .proto
      * file.  Thus, these types will *not* be nested inside the outer class
      * named by java_outer_classname.  However, the outer class will still be
      * generated to contain the file's getDescriptor() method as well as any
      * top-level extensions defined in the file.
-     * </pre>
      *
-     * <code>optional bool java_multiple_files = 10 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_multiple_files = 10 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setJavaMultipleFiles($var)
     {
@@ -336,11 +303,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * This option does nothing.
-     * </pre>
      *
-     * <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code>
+     * Generated from protobuf field <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code>
+     * @return bool
      */
     public function getJavaGenerateEqualsAndHash()
     {
@@ -348,11 +314,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * This option does nothing.
-     * </pre>
      *
-     * <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code>
+     * Generated from protobuf field <code>optional bool java_generate_equals_and_hash = 20 [deprecated = true];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setJavaGenerateEqualsAndHash($var)
     {
@@ -369,16 +335,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set true, then the Java2 code generator will generate code that
      * throws an exception whenever an attempt is made to assign a non-UTF-8
      * byte sequence to a string field.
      * Message reflection will do the same.
      * However, an extension field still accepts non-UTF-8 byte sequences.
      * This option has no effect on when used with the lite runtime.
-     * </pre>
      *
-     * <code>optional bool java_string_check_utf8 = 27 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_string_check_utf8 = 27 [default = false];</code>
+     * @return bool
      */
     public function getJavaStringCheckUtf8()
     {
@@ -386,16 +351,16 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If set true, then the Java2 code generator will generate code that
      * throws an exception whenever an attempt is made to assign a non-UTF-8
      * byte sequence to a string field.
      * Message reflection will do the same.
      * However, an extension field still accepts non-UTF-8 byte sequences.
      * This option has no effect on when used with the lite runtime.
-     * </pre>
      *
-     * <code>optional bool java_string_check_utf8 = 27 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_string_check_utf8 = 27 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setJavaStringCheckUtf8($var)
     {
@@ -412,7 +377,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code>
+     * @return int
      */
     public function getOptimizeFor()
     {
@@ -420,7 +386,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];</code>
+     * @param int $var
+     * @return $this
      */
     public function setOptimizeFor($var)
     {
@@ -437,15 +405,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the Go package where structs generated from this .proto will be
      * placed. If omitted, the Go package will be derived from the following:
      *   - The basename of the package import path, if provided.
      *   - Otherwise, the package statement in the .proto file, if present.
      *   - Otherwise, the basename of the .proto file, without extension.
-     * </pre>
      *
-     * <code>optional string go_package = 11;</code>
+     * Generated from protobuf field <code>optional string go_package = 11;</code>
+     * @return string
      */
     public function getGoPackage()
     {
@@ -453,15 +420,15 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the Go package where structs generated from this .proto will be
      * placed. If omitted, the Go package will be derived from the following:
      *   - The basename of the package import path, if provided.
      *   - Otherwise, the package statement in the .proto file, if present.
      *   - Otherwise, the basename of the .proto file, without extension.
-     * </pre>
      *
-     * <code>optional string go_package = 11;</code>
+     * Generated from protobuf field <code>optional string go_package = 11;</code>
+     * @param string $var
+     * @return $this
      */
     public function setGoPackage($var)
     {
@@ -478,7 +445,6 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Should generic services be generated in each language?  "Generic" services
      * are not specific to any particular RPC system.  They are generated by the
      * main code generators in each language (without additional plugins).
@@ -488,9 +454,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message
      * that generate code specific to your particular RPC system.  Therefore,
      * these default to false.  Old code which depends on generic services should
      * explicitly set them to true.
-     * </pre>
      *
-     * <code>optional bool cc_generic_services = 16 [default = false];</code>
+     * Generated from protobuf field <code>optional bool cc_generic_services = 16 [default = false];</code>
+     * @return bool
      */
     public function getCcGenericServices()
     {
@@ -498,7 +464,6 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Should generic services be generated in each language?  "Generic" services
      * are not specific to any particular RPC system.  They are generated by the
      * main code generators in each language (without additional plugins).
@@ -508,9 +473,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message
      * that generate code specific to your particular RPC system.  Therefore,
      * these default to false.  Old code which depends on generic services should
      * explicitly set them to true.
-     * </pre>
      *
-     * <code>optional bool cc_generic_services = 16 [default = false];</code>
+     * Generated from protobuf field <code>optional bool cc_generic_services = 16 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setCcGenericServices($var)
     {
@@ -527,7 +493,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional bool java_generic_services = 17 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_generic_services = 17 [default = false];</code>
+     * @return bool
      */
     public function getJavaGenericServices()
     {
@@ -535,7 +502,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional bool java_generic_services = 17 [default = false];</code>
+     * Generated from protobuf field <code>optional bool java_generic_services = 17 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setJavaGenericServices($var)
     {
@@ -552,7 +521,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional bool py_generic_services = 18 [default = false];</code>
+     * Generated from protobuf field <code>optional bool py_generic_services = 18 [default = false];</code>
+     * @return bool
      */
     public function getPyGenericServices()
     {
@@ -560,7 +530,9 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional bool py_generic_services = 18 [default = false];</code>
+     * Generated from protobuf field <code>optional bool py_generic_services = 18 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setPyGenericServices($var)
     {
@@ -577,14 +549,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this file deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for everything in the file, or it will be completely ignored; in the very
      * least, this is a formalization for deprecating files.
-     * </pre>
      *
-     * <code>optional bool deprecated = 23 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 23 [default = false];</code>
+     * @return bool
      */
     public function getDeprecated()
     {
@@ -592,14 +563,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this file deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for everything in the file, or it will be completely ignored; in the very
      * least, this is a formalization for deprecating files.
-     * </pre>
      *
-     * <code>optional bool deprecated = 23 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 23 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setDeprecated($var)
     {
@@ -616,12 +587,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Enables the use of arenas for the proto messages in this file. This applies
      * only to generated classes for C++.
-     * </pre>
      *
-     * <code>optional bool cc_enable_arenas = 31 [default = false];</code>
+     * Generated from protobuf field <code>optional bool cc_enable_arenas = 31 [default = false];</code>
+     * @return bool
      */
     public function getCcEnableArenas()
     {
@@ -629,12 +599,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Enables the use of arenas for the proto messages in this file. This applies
      * only to generated classes for C++.
-     * </pre>
      *
-     * <code>optional bool cc_enable_arenas = 31 [default = false];</code>
+     * Generated from protobuf field <code>optional bool cc_enable_arenas = 31 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setCcEnableArenas($var)
     {
@@ -651,12 +621,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the objective c class prefix which is prepended to all objective c
      * generated classes from this .proto. There is no default.
-     * </pre>
      *
-     * <code>optional string objc_class_prefix = 36;</code>
+     * Generated from protobuf field <code>optional string objc_class_prefix = 36;</code>
+     * @return string
      */
     public function getObjcClassPrefix()
     {
@@ -664,12 +633,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the objective c class prefix which is prepended to all objective c
      * generated classes from this .proto. There is no default.
-     * </pre>
      *
-     * <code>optional string objc_class_prefix = 36;</code>
+     * Generated from protobuf field <code>optional string objc_class_prefix = 36;</code>
+     * @param string $var
+     * @return $this
      */
     public function setObjcClassPrefix($var)
     {
@@ -686,11 +655,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Namespace for generated classes; defaults to the package.
-     * </pre>
      *
-     * <code>optional string csharp_namespace = 37;</code>
+     * Generated from protobuf field <code>optional string csharp_namespace = 37;</code>
+     * @return string
      */
     public function getCsharpNamespace()
     {
@@ -698,11 +666,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Namespace for generated classes; defaults to the package.
-     * </pre>
      *
-     * <code>optional string csharp_namespace = 37;</code>
+     * Generated from protobuf field <code>optional string csharp_namespace = 37;</code>
+     * @param string $var
+     * @return $this
      */
     public function setCsharpNamespace($var)
     {
@@ -719,14 +687,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * By default Swift generators will take the proto package and CamelCase it
      * replacing '.' with underscore and use that to prefix the types/symbols
      * defined. When this options is provided, they will use this value instead
      * to prefix the types/symbols defined.
-     * </pre>
      *
-     * <code>optional string swift_prefix = 39;</code>
+     * Generated from protobuf field <code>optional string swift_prefix = 39;</code>
+     * @return string
      */
     public function getSwiftPrefix()
     {
@@ -734,14 +701,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * By default Swift generators will take the proto package and CamelCase it
      * replacing '.' with underscore and use that to prefix the types/symbols
      * defined. When this options is provided, they will use this value instead
      * to prefix the types/symbols defined.
-     * </pre>
      *
-     * <code>optional string swift_prefix = 39;</code>
+     * Generated from protobuf field <code>optional string swift_prefix = 39;</code>
+     * @param string $var
+     * @return $this
      */
     public function setSwiftPrefix($var)
     {
@@ -758,12 +725,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the php class prefix which is prepended to all php generated classes
      * from this .proto. Default is empty.
-     * </pre>
      *
-     * <code>optional string php_class_prefix = 40;</code>
+     * Generated from protobuf field <code>optional string php_class_prefix = 40;</code>
+     * @return string
      */
     public function getPhpClassPrefix()
     {
@@ -771,12 +737,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Sets the php class prefix which is prepended to all php generated classes
      * from this .proto. Default is empty.
-     * </pre>
      *
-     * <code>optional string php_class_prefix = 40;</code>
+     * Generated from protobuf field <code>optional string php_class_prefix = 40;</code>
+     * @param string $var
+     * @return $this
      */
     public function setPhpClassPrefix($var)
     {
@@ -793,13 +759,12 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Use this option to change the namespace of php generated classes. Default
      * is empty. When this option is empty, the package name will be used for
      * determining the namespace.
-     * </pre>
      *
-     * <code>optional string php_namespace = 41;</code>
+     * Generated from protobuf field <code>optional string php_namespace = 41;</code>
+     * @return string
      */
     public function getPhpNamespace()
     {
@@ -807,13 +772,13 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Use this option to change the namespace of php generated classes. Default
      * is empty. When this option is empty, the package name will be used for
      * determining the namespace.
-     * </pre>
      *
-     * <code>optional string php_namespace = 41;</code>
+     * Generated from protobuf field <code>optional string php_namespace = 41;</code>
+     * @param string $var
+     * @return $this
      */
     public function setPhpNamespace($var)
     {
@@ -830,11 +795,10 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -842,11 +806,11 @@ class FileOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 4 - 12
php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php

@@ -5,36 +5,28 @@
 namespace Google\Protobuf\Internal;
 
 /**
- * <pre>
  * Generated classes can be optimized for speed or code size.
- * </pre>
  *
- * Protobuf enum <code>google.protobuf.FileOptions.OptimizeMode</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
  */
 class FileOptions_OptimizeMode
 {
     /**
-     * <pre>
      * Generate complete code for parsing, serialization,
-     * </pre>
      *
-     * <code>SPEED = 1;</code>
+     * Generated from protobuf enum <code>SPEED = 1;</code>
      */
     const SPEED = 1;
     /**
-     * <pre>
      * etc.
-     * </pre>
      *
-     * <code>CODE_SIZE = 2;</code>
+     * Generated from protobuf enum <code>CODE_SIZE = 2;</code>
      */
     const CODE_SIZE = 2;
     /**
-     * <pre>
      * Generate code using MessageLite and the lite runtime.
-     * </pre>
      *
-     * <code>LITE_RUNTIME = 3;</code>
+     * Generated from protobuf enum <code>LITE_RUNTIME = 3;</code>
      */
     const LITE_RUNTIME = 3;
 }

+ 7 - 12
php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php

@@ -12,23 +12,19 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes the relationship between generated code and its original source
  * file. A GeneratedCodeInfo message is associated with only one generated
  * source file, but may contain references to different source .proto files.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.GeneratedCodeInfo</code>
+ * Generated from protobuf message <code>google.protobuf.GeneratedCodeInfo</code>
  */
 class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * An Annotation connects some span of text in generated code to an element
      * of its generating .proto file.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
      */
     private $annotation;
     private $has_annotation = false;
@@ -39,12 +35,11 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * An Annotation connects some span of text in generated code to an element
      * of its generating .proto file.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getAnnotation()
     {
@@ -52,12 +47,12 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * An Annotation connects some span of text in generated code to an element
      * of its generating .proto file.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
+     * @param \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setAnnotation(&$var)
     {

+ 25 - 37
php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php

@@ -12,47 +12,39 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.GeneratedCodeInfo.Annotation</code>
+ * Generated from protobuf message <code>google.protobuf.GeneratedCodeInfo.Annotation</code>
  */
 class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Identifies the element in the original source .proto file. This field
      * is formatted the same as SourceCodeInfo.Location.path.
-     * </pre>
      *
-     * <code>repeated int32 path = 1 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
      */
     private $path;
     private $has_path = false;
     /**
-     * <pre>
      * Identifies the filesystem path to the original source .proto.
-     * </pre>
      *
-     * <code>optional string source_file = 2;</code>
+     * Generated from protobuf field <code>optional string source_file = 2;</code>
      */
     private $source_file = '';
     private $has_source_file = false;
     /**
-     * <pre>
      * Identifies the starting offset in bytes in the generated code
      * that relates to the identified object.
-     * </pre>
      *
-     * <code>optional int32 begin = 3;</code>
+     * Generated from protobuf field <code>optional int32 begin = 3;</code>
      */
     private $begin = 0;
     private $has_begin = false;
     /**
-     * <pre>
      * Identifies the ending offset in bytes in the generated code that
      * relates to the identified offset. The end offset should be one past
      * the last relevant byte (so the length of the text = end - begin).
-     * </pre>
      *
-     * <code>optional int32 end = 4;</code>
+     * Generated from protobuf field <code>optional int32 end = 4;</code>
      */
     private $end = 0;
     private $has_end = false;
@@ -63,12 +55,11 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the element in the original source .proto file. This field
      * is formatted the same as SourceCodeInfo.Location.path.
-     * </pre>
      *
-     * <code>repeated int32 path = 1 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getPath()
     {
@@ -76,12 +67,12 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the element in the original source .proto file. This field
      * is formatted the same as SourceCodeInfo.Location.path.
-     * </pre>
      *
-     * <code>repeated int32 path = 1 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
+     * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setPath(&$var)
     {
@@ -98,11 +89,10 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the filesystem path to the original source .proto.
-     * </pre>
      *
-     * <code>optional string source_file = 2;</code>
+     * Generated from protobuf field <code>optional string source_file = 2;</code>
+     * @return string
      */
     public function getSourceFile()
     {
@@ -110,11 +100,11 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the filesystem path to the original source .proto.
-     * </pre>
      *
-     * <code>optional string source_file = 2;</code>
+     * Generated from protobuf field <code>optional string source_file = 2;</code>
+     * @param string $var
+     * @return $this
      */
     public function setSourceFile($var)
     {
@@ -131,12 +121,11 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the starting offset in bytes in the generated code
      * that relates to the identified object.
-     * </pre>
      *
-     * <code>optional int32 begin = 3;</code>
+     * Generated from protobuf field <code>optional int32 begin = 3;</code>
+     * @return int
      */
     public function getBegin()
     {
@@ -144,12 +133,12 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the starting offset in bytes in the generated code
      * that relates to the identified object.
-     * </pre>
      *
-     * <code>optional int32 begin = 3;</code>
+     * Generated from protobuf field <code>optional int32 begin = 3;</code>
+     * @param int $var
+     * @return $this
      */
     public function setBegin($var)
     {
@@ -166,13 +155,12 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the ending offset in bytes in the generated code that
      * relates to the identified offset. The end offset should be one past
      * the last relevant byte (so the length of the text = end - begin).
-     * </pre>
      *
-     * <code>optional int32 end = 4;</code>
+     * Generated from protobuf field <code>optional int32 end = 4;</code>
+     * @return int
      */
     public function getEnd()
     {
@@ -180,13 +168,13 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies the ending offset in bytes in the generated code that
      * relates to the identified offset. The end offset should be one past
      * the last relevant byte (so the length of the text = end - begin).
-     * </pre>
      *
-     * <code>optional int32 end = 4;</code>
+     * Generated from protobuf field <code>optional int32 end = 4;</code>
+     * @param int $var
+     * @return $this
      */
     public function setEnd($var)
     {

+ 34 - 49
php/src/Google/Protobuf/Internal/MessageOptions.php

@@ -12,12 +12,11 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.MessageOptions</code>
+ * Generated from protobuf message <code>google.protobuf.MessageOptions</code>
  */
 class MessageOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Set true to use the old proto1 MessageSet wire format for extensions.
      * This is provided for backwards-compatibility with the MessageSet wire
      * format.  You should not use this for any other reason:  It's less
@@ -33,41 +32,35 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * be int32s, enums, or repeated messages.
      * Because this is an option, the above two restrictions are not enforced by
      * the protocol compiler.
-     * </pre>
      *
-     * <code>optional bool message_set_wire_format = 1 [default = false];</code>
+     * Generated from protobuf field <code>optional bool message_set_wire_format = 1 [default = false];</code>
      */
     private $message_set_wire_format = false;
     private $has_message_set_wire_format = false;
     /**
-     * <pre>
      * Disables the generation of the standard "descriptor()" accessor, which can
      * conflict with a field of the same name.  This is meant to make migration
      * from proto1 easier; new code should avoid fields named "descriptor".
-     * </pre>
      *
-     * <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code>
+     * Generated from protobuf field <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code>
      */
     private $no_standard_descriptor_accessor = false;
     private $has_no_standard_descriptor_accessor = false;
     /**
-     * <pre>
      * Is this message deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the message, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating messages.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
      */
     private $deprecated = false;
     private $has_deprecated = false;
     /**
-     * <pre>
      * Whether the message is an automatically generated map entry type for the
      * maps field.
      * For maps fields:
-     *     map&lt;KeyType, ValueType&gt; map_field = 1;
+     *     map<KeyType, ValueType> map_field = 1;
      * The parsed descriptor looks like:
      *     message MapFieldEntry {
      *         option map_entry = true;
@@ -82,18 +75,15 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * NOTE: Do not set the option in .proto files. Always use the maps syntax
      * instead. The option should only be implicitly set by the proto compiler
      * parser.
-     * </pre>
      *
-     * <code>optional bool map_entry = 7;</code>
+     * Generated from protobuf field <code>optional bool map_entry = 7;</code>
      */
     private $map_entry = false;
     private $has_map_entry = false;
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -104,7 +94,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Set true to use the old proto1 MessageSet wire format for extensions.
      * This is provided for backwards-compatibility with the MessageSet wire
      * format.  You should not use this for any other reason:  It's less
@@ -120,9 +109,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * be int32s, enums, or repeated messages.
      * Because this is an option, the above two restrictions are not enforced by
      * the protocol compiler.
-     * </pre>
      *
-     * <code>optional bool message_set_wire_format = 1 [default = false];</code>
+     * Generated from protobuf field <code>optional bool message_set_wire_format = 1 [default = false];</code>
+     * @return bool
      */
     public function getMessageSetWireFormat()
     {
@@ -130,7 +119,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Set true to use the old proto1 MessageSet wire format for extensions.
      * This is provided for backwards-compatibility with the MessageSet wire
      * format.  You should not use this for any other reason:  It's less
@@ -146,9 +134,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * be int32s, enums, or repeated messages.
      * Because this is an option, the above two restrictions are not enforced by
      * the protocol compiler.
-     * </pre>
      *
-     * <code>optional bool message_set_wire_format = 1 [default = false];</code>
+     * Generated from protobuf field <code>optional bool message_set_wire_format = 1 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setMessageSetWireFormat($var)
     {
@@ -165,13 +154,12 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Disables the generation of the standard "descriptor()" accessor, which can
      * conflict with a field of the same name.  This is meant to make migration
      * from proto1 easier; new code should avoid fields named "descriptor".
-     * </pre>
      *
-     * <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code>
+     * Generated from protobuf field <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code>
+     * @return bool
      */
     public function getNoStandardDescriptorAccessor()
     {
@@ -179,13 +167,13 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Disables the generation of the standard "descriptor()" accessor, which can
      * conflict with a field of the same name.  This is meant to make migration
      * from proto1 easier; new code should avoid fields named "descriptor".
-     * </pre>
      *
-     * <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code>
+     * Generated from protobuf field <code>optional bool no_standard_descriptor_accessor = 2 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setNoStandardDescriptorAccessor($var)
     {
@@ -202,14 +190,13 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this message deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the message, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating messages.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
+     * @return bool
      */
     public function getDeprecated()
     {
@@ -217,14 +204,14 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this message deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the message, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating messages.
-     * </pre>
      *
-     * <code>optional bool deprecated = 3 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 3 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setDeprecated($var)
     {
@@ -241,11 +228,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Whether the message is an automatically generated map entry type for the
      * maps field.
      * For maps fields:
-     *     map&lt;KeyType, ValueType&gt; map_field = 1;
+     *     map<KeyType, ValueType> map_field = 1;
      * The parsed descriptor looks like:
      *     message MapFieldEntry {
      *         option map_entry = true;
@@ -260,9 +246,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * NOTE: Do not set the option in .proto files. Always use the maps syntax
      * instead. The option should only be implicitly set by the proto compiler
      * parser.
-     * </pre>
      *
-     * <code>optional bool map_entry = 7;</code>
+     * Generated from protobuf field <code>optional bool map_entry = 7;</code>
+     * @return bool
      */
     public function getMapEntry()
     {
@@ -270,11 +256,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Whether the message is an automatically generated map entry type for the
      * maps field.
      * For maps fields:
-     *     map&lt;KeyType, ValueType&gt; map_field = 1;
+     *     map<KeyType, ValueType> map_field = 1;
      * The parsed descriptor looks like:
      *     message MapFieldEntry {
      *         option map_entry = true;
@@ -289,9 +274,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
      * NOTE: Do not set the option in .proto files. Always use the maps syntax
      * instead. The option should only be implicitly set by the proto compiler
      * parser.
-     * </pre>
      *
-     * <code>optional bool map_entry = 7;</code>
+     * Generated from protobuf field <code>optional bool map_entry = 7;</code>
+     * @param bool $var
+     * @return $this
      */
     public function setMapEntry($var)
     {
@@ -308,11 +294,10 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -320,11 +305,11 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 37 - 39
php/src/Google/Protobuf/Internal/MethodDescriptorProto.php

@@ -12,54 +12,46 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes a method of a service.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.MethodDescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.MethodDescriptorProto</code>
  */
 class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <pre>
      * Input and output type names.  These are resolved in the same way as
      * FieldDescriptorProto.type_name, but must refer to a message type.
-     * </pre>
      *
-     * <code>optional string input_type = 2;</code>
+     * Generated from protobuf field <code>optional string input_type = 2;</code>
      */
     private $input_type = '';
     private $has_input_type = false;
     /**
-     * <code>optional string output_type = 3;</code>
+     * Generated from protobuf field <code>optional string output_type = 3;</code>
      */
     private $output_type = '';
     private $has_output_type = false;
     /**
-     * <code>optional .google.protobuf.MethodOptions options = 4;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MethodOptions options = 4;</code>
      */
     private $options = null;
     private $has_options = false;
     /**
-     * <pre>
      * Identifies if client streams multiple client messages
-     * </pre>
      *
-     * <code>optional bool client_streaming = 5 [default = false];</code>
+     * Generated from protobuf field <code>optional bool client_streaming = 5 [default = false];</code>
      */
     private $client_streaming = false;
     private $has_client_streaming = false;
     /**
-     * <pre>
      * Identifies if server streams multiple server messages
-     * </pre>
      *
-     * <code>optional bool server_streaming = 6 [default = false];</code>
+     * Generated from protobuf field <code>optional bool server_streaming = 6 [default = false];</code>
      */
     private $server_streaming = false;
     private $has_server_streaming = false;
@@ -70,7 +62,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -78,7 +71,9 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -95,12 +90,11 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Input and output type names.  These are resolved in the same way as
      * FieldDescriptorProto.type_name, but must refer to a message type.
-     * </pre>
      *
-     * <code>optional string input_type = 2;</code>
+     * Generated from protobuf field <code>optional string input_type = 2;</code>
+     * @return string
      */
     public function getInputType()
     {
@@ -108,12 +102,12 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Input and output type names.  These are resolved in the same way as
      * FieldDescriptorProto.type_name, but must refer to a message type.
-     * </pre>
      *
-     * <code>optional string input_type = 2;</code>
+     * Generated from protobuf field <code>optional string input_type = 2;</code>
+     * @param string $var
+     * @return $this
      */
     public function setInputType($var)
     {
@@ -130,7 +124,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string output_type = 3;</code>
+     * Generated from protobuf field <code>optional string output_type = 3;</code>
+     * @return string
      */
     public function getOutputType()
     {
@@ -138,7 +133,9 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string output_type = 3;</code>
+     * Generated from protobuf field <code>optional string output_type = 3;</code>
+     * @param string $var
+     * @return $this
      */
     public function setOutputType($var)
     {
@@ -155,7 +152,8 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.MethodOptions options = 4;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MethodOptions options = 4;</code>
+     * @return \Google\Protobuf\Internal\MethodOptions
      */
     public function getOptions()
     {
@@ -163,7 +161,9 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.MethodOptions options = 4;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MethodOptions options = 4;</code>
+     * @param \Google\Protobuf\Internal\MethodOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {
@@ -180,11 +180,10 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies if client streams multiple client messages
-     * </pre>
      *
-     * <code>optional bool client_streaming = 5 [default = false];</code>
+     * Generated from protobuf field <code>optional bool client_streaming = 5 [default = false];</code>
+     * @return bool
      */
     public function getClientStreaming()
     {
@@ -192,11 +191,11 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies if client streams multiple client messages
-     * </pre>
      *
-     * <code>optional bool client_streaming = 5 [default = false];</code>
+     * Generated from protobuf field <code>optional bool client_streaming = 5 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setClientStreaming($var)
     {
@@ -213,11 +212,10 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies if server streams multiple server messages
-     * </pre>
      *
-     * <code>optional bool server_streaming = 6 [default = false];</code>
+     * Generated from protobuf field <code>optional bool server_streaming = 6 [default = false];</code>
+     * @return bool
      */
     public function getServerStreaming()
     {
@@ -225,11 +223,11 @@ class MethodDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies if server streams multiple server messages
-     * </pre>
      *
-     * <code>optional bool server_streaming = 6 [default = false];</code>
+     * Generated from protobuf field <code>optional bool server_streaming = 6 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setServerStreaming($var)
     {

+ 19 - 22
php/src/Google/Protobuf/Internal/MethodOptions.php

@@ -12,33 +12,29 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.MethodOptions</code>
+ * Generated from protobuf message <code>google.protobuf.MethodOptions</code>
  */
 class MethodOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Is this method deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the method, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating methods.
-     * </pre>
      *
-     * <code>optional bool deprecated = 33 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 33 [default = false];</code>
      */
     private $deprecated = false;
     private $has_deprecated = false;
     /**
-     * <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code>
      */
     private $idempotency_level = 0;
     private $has_idempotency_level = false;
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -49,14 +45,13 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this method deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the method, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating methods.
-     * </pre>
      *
-     * <code>optional bool deprecated = 33 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 33 [default = false];</code>
+     * @return bool
      */
     public function getDeprecated()
     {
@@ -64,14 +59,14 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this method deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the method, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating methods.
-     * </pre>
      *
-     * <code>optional bool deprecated = 33 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 33 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setDeprecated($var)
     {
@@ -88,7 +83,8 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code>
+     * @return int
      */
     public function getIdempotencyLevel()
     {
@@ -96,7 +92,9 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code>
+     * Generated from protobuf field <code>optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];</code>
+     * @param int $var
+     * @return $this
      */
     public function setIdempotencyLevel($var)
     {
@@ -113,11 +111,10 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -125,11 +122,11 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 4 - 10
php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php

@@ -5,34 +5,28 @@
 namespace Google\Protobuf\Internal;
 
 /**
- * <pre>
  * Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
  * or neither? HTTP based RPC implementation may choose GET verb for safe
  * methods, and PUT verb for idempotent methods instead of the default POST.
- * </pre>
  *
- * Protobuf enum <code>google.protobuf.MethodOptions.IdempotencyLevel</code>
+ * Protobuf enum <code>Google\Protobuf\Internal</code>
  */
 class MethodOptions_IdempotencyLevel
 {
     /**
-     * <code>IDEMPOTENCY_UNKNOWN = 0;</code>
+     * Generated from protobuf enum <code>IDEMPOTENCY_UNKNOWN = 0;</code>
      */
     const IDEMPOTENCY_UNKNOWN = 0;
     /**
-     * <pre>
      * implies idempotent
-     * </pre>
      *
-     * <code>NO_SIDE_EFFECTS = 1;</code>
+     * Generated from protobuf enum <code>NO_SIDE_EFFECTS = 1;</code>
      */
     const NO_SIDE_EFFECTS = 1;
     /**
-     * <pre>
      * idempotent, but may have side effects
-     * </pre>
      *
-     * <code>IDEMPOTENT = 2;</code>
+     * Generated from protobuf enum <code>IDEMPOTENT = 2;</code>
      */
     const IDEMPOTENT = 2;
 }

+ 13 - 9
php/src/Google/Protobuf/Internal/OneofDescriptorProto.php

@@ -12,21 +12,19 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes a oneof.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.OneofDescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.OneofDescriptorProto</code>
  */
 class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <code>optional .google.protobuf.OneofOptions options = 2;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.OneofOptions options = 2;</code>
      */
     private $options = null;
     private $has_options = false;
@@ -37,7 +35,8 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -45,7 +44,9 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -62,7 +63,8 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.OneofOptions options = 2;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.OneofOptions options = 2;</code>
+     * @return \Google\Protobuf\Internal\OneofOptions
      */
     public function getOptions()
     {
@@ -70,7 +72,9 @@ class OneofDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.OneofOptions options = 2;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.OneofOptions options = 2;</code>
+     * @param \Google\Protobuf\Internal\OneofOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {

+ 7 - 10
php/src/Google/Protobuf/Internal/OneofOptions.php

@@ -12,16 +12,14 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.OneofOptions</code>
+ * Generated from protobuf message <code>google.protobuf.OneofOptions</code>
  */
 class OneofOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -32,11 +30,10 @@ class OneofOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -44,11 +41,11 @@ class OneofOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 19 - 12
php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php

@@ -12,26 +12,24 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Describes a service.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.ServiceDescriptorProto</code>
+ * Generated from protobuf message <code>google.protobuf.ServiceDescriptorProto</code>
  */
 class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
      */
     private $name = '';
     private $has_name = false;
     /**
-     * <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code>
      */
     private $method;
     private $has_method = false;
     /**
-     * <code>optional .google.protobuf.ServiceOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.ServiceOptions options = 3;</code>
      */
     private $options = null;
     private $has_options = false;
@@ -42,7 +40,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @return string
      */
     public function getName()
     {
@@ -50,7 +49,9 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string name = 1;</code>
+     * Generated from protobuf field <code>optional string name = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setName($var)
     {
@@ -67,7 +68,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getMethod()
     {
@@ -75,7 +77,9 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code>
+     * @param \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setMethod(&$var)
     {
@@ -92,7 +96,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.ServiceOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.ServiceOptions options = 3;</code>
+     * @return \Google\Protobuf\Internal\ServiceOptions
      */
     public function getOptions()
     {
@@ -100,7 +105,9 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional .google.protobuf.ServiceOptions options = 3;</code>
+     * Generated from protobuf field <code>optional .google.protobuf.ServiceOptions options = 3;</code>
+     * @param \Google\Protobuf\Internal\ServiceOptions $var
+     * @return $this
      */
     public function setOptions(&$var)
     {

+ 13 - 19
php/src/Google/Protobuf/Internal/ServiceOptions.php

@@ -12,28 +12,24 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.ServiceOptions</code>
+ * Generated from protobuf message <code>google.protobuf.ServiceOptions</code>
  */
 class ServiceOptions extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Is this service deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the service, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating services.
-     * </pre>
      *
-     * <code>optional bool deprecated = 33 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 33 [default = false];</code>
      */
     private $deprecated = false;
     private $has_deprecated = false;
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
      */
     private $uninterpreted_option;
     private $has_uninterpreted_option = false;
@@ -44,14 +40,13 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this service deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the service, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating services.
-     * </pre>
      *
-     * <code>optional bool deprecated = 33 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 33 [default = false];</code>
+     * @return bool
      */
     public function getDeprecated()
     {
@@ -59,14 +54,14 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Is this service deprecated?
      * Depending on the target platform, this can emit Deprecated annotations
      * for the service, or it will be completely ignored; in the very least,
      * this is a formalization for deprecating services.
-     * </pre>
      *
-     * <code>optional bool deprecated = 33 [default = false];</code>
+     * Generated from protobuf field <code>optional bool deprecated = 33 [default = false];</code>
+     * @param bool $var
+     * @return $this
      */
     public function setDeprecated($var)
     {
@@ -83,11 +78,10 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getUninterpretedOption()
     {
@@ -95,11 +89,11 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The parser stores options it doesn't recognize here. See above.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setUninterpretedOption(&$var)
     {

+ 7 - 12
php/src/Google/Protobuf/Internal/SourceCodeInfo.php

@@ -12,17 +12,14 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * Encapsulates information about the original source file from which a
  * FileDescriptorProto was generated.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.SourceCodeInfo</code>
+ * Generated from protobuf message <code>google.protobuf.SourceCodeInfo</code>
  */
 class SourceCodeInfo extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * A Location identifies a piece of source code in a .proto file which
      * corresponds to a particular definition.  This information is intended
      * to be useful to IDEs, code indexers, documentation generators, and similar
@@ -64,9 +61,8 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
      * - Code which tries to interpret locations should probably be designed to
      *   ignore those that it doesn't understand, as more types of locations could
      *   be recorded in the future.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
      */
     private $location;
     private $has_location = false;
@@ -77,7 +73,6 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * A Location identifies a piece of source code in a .proto file which
      * corresponds to a particular definition.  This information is intended
      * to be useful to IDEs, code indexers, documentation generators, and similar
@@ -119,9 +114,9 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
      * - Code which tries to interpret locations should probably be designed to
      *   ignore those that it doesn't understand, as more types of locations could
      *   be recorded in the future.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getLocation()
     {
@@ -129,7 +124,6 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * A Location identifies a piece of source code in a .proto file which
      * corresponds to a particular definition.  This information is intended
      * to be useful to IDEs, code indexers, documentation generators, and similar
@@ -171,9 +165,10 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
      * - Code which tries to interpret locations should probably be designed to
      *   ignore those that it doesn't understand, as more types of locations could
      *   be recorded in the future.
-     * </pre>
      *
-     * <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
+     * @param \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setLocation(&$var)
     {

+ 31 - 34
php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php

@@ -12,12 +12,11 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * Protobuf type <code>google.protobuf.SourceCodeInfo.Location</code>
+ * Generated from protobuf message <code>google.protobuf.SourceCodeInfo.Location</code>
  */
 class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <pre>
      * Identifies which part of the FileDescriptorProto was defined at this
      * location.
      * Each element is a field number or an index.  They form a path from
@@ -39,27 +38,23 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *   [ 4, 3, 2, 7 ]
      * this path refers to the whole field declaration (from the beginning
      * of the label to the terminating semicolon).
-     * </pre>
      *
-     * <code>repeated int32 path = 1 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
      */
     private $path;
     private $has_path = false;
     /**
-     * <pre>
      * Always has exactly three or four elements: start line, start column,
      * end line (optional, otherwise assumed same as start line), end column.
      * These are packed into a single field for efficiency.  Note that line
      * and column numbers are zero-based -- typically you will want to add
      * 1 to each before displaying to a user.
-     * </pre>
      *
-     * <code>repeated int32 span = 2 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 span = 2 [packed = true];</code>
      */
     private $span;
     private $has_span = false;
     /**
-     * <pre>
      * If this SourceCodeInfo represents a complete declaration, these are any
      * comments appearing before and after the declaration which appear to be
      * attached to the declaration.
@@ -96,19 +91,18 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *    * grault. *&#47;
      *   optional int32 grault = 6;
      *   // ignored detached comments.
-     * </pre>
      *
-     * <code>optional string leading_comments = 3;</code>
+     * Generated from protobuf field <code>optional string leading_comments = 3;</code>
      */
     private $leading_comments = '';
     private $has_leading_comments = false;
     /**
-     * <code>optional string trailing_comments = 4;</code>
+     * Generated from protobuf field <code>optional string trailing_comments = 4;</code>
      */
     private $trailing_comments = '';
     private $has_trailing_comments = false;
     /**
-     * <code>repeated string leading_detached_comments = 6;</code>
+     * Generated from protobuf field <code>repeated string leading_detached_comments = 6;</code>
      */
     private $leading_detached_comments;
     private $has_leading_detached_comments = false;
@@ -119,7 +113,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies which part of the FileDescriptorProto was defined at this
      * location.
      * Each element is a field number or an index.  They form a path from
@@ -141,9 +134,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *   [ 4, 3, 2, 7 ]
      * this path refers to the whole field declaration (from the beginning
      * of the label to the terminating semicolon).
-     * </pre>
      *
-     * <code>repeated int32 path = 1 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getPath()
     {
@@ -151,7 +144,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Identifies which part of the FileDescriptorProto was defined at this
      * location.
      * Each element is a field number or an index.  They form a path from
@@ -173,9 +165,10 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *   [ 4, 3, 2, 7 ]
      * this path refers to the whole field declaration (from the beginning
      * of the label to the terminating semicolon).
-     * </pre>
      *
-     * <code>repeated int32 path = 1 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
+     * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setPath(&$var)
     {
@@ -192,15 +185,14 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Always has exactly three or four elements: start line, start column,
      * end line (optional, otherwise assumed same as start line), end column.
      * These are packed into a single field for efficiency.  Note that line
      * and column numbers are zero-based -- typically you will want to add
      * 1 to each before displaying to a user.
-     * </pre>
      *
-     * <code>repeated int32 span = 2 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 span = 2 [packed = true];</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getSpan()
     {
@@ -208,15 +200,15 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * Always has exactly three or four elements: start line, start column,
      * end line (optional, otherwise assumed same as start line), end column.
      * These are packed into a single field for efficiency.  Note that line
      * and column numbers are zero-based -- typically you will want to add
      * 1 to each before displaying to a user.
-     * </pre>
      *
-     * <code>repeated int32 span = 2 [packed = true];</code>
+     * Generated from protobuf field <code>repeated int32 span = 2 [packed = true];</code>
+     * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setSpan(&$var)
     {
@@ -233,7 +225,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If this SourceCodeInfo represents a complete declaration, these are any
      * comments appearing before and after the declaration which appear to be
      * attached to the declaration.
@@ -270,9 +261,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *    * grault. *&#47;
      *   optional int32 grault = 6;
      *   // ignored detached comments.
-     * </pre>
      *
-     * <code>optional string leading_comments = 3;</code>
+     * Generated from protobuf field <code>optional string leading_comments = 3;</code>
+     * @return string
      */
     public function getLeadingComments()
     {
@@ -280,7 +271,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * If this SourceCodeInfo represents a complete declaration, these are any
      * comments appearing before and after the declaration which appear to be
      * attached to the declaration.
@@ -317,9 +307,10 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
      *    * grault. *&#47;
      *   optional int32 grault = 6;
      *   // ignored detached comments.
-     * </pre>
      *
-     * <code>optional string leading_comments = 3;</code>
+     * Generated from protobuf field <code>optional string leading_comments = 3;</code>
+     * @param string $var
+     * @return $this
      */
     public function setLeadingComments($var)
     {
@@ -336,7 +327,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string trailing_comments = 4;</code>
+     * Generated from protobuf field <code>optional string trailing_comments = 4;</code>
+     * @return string
      */
     public function getTrailingComments()
     {
@@ -344,7 +336,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string trailing_comments = 4;</code>
+     * Generated from protobuf field <code>optional string trailing_comments = 4;</code>
+     * @param string $var
+     * @return $this
      */
     public function setTrailingComments($var)
     {
@@ -361,7 +355,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated string leading_detached_comments = 6;</code>
+     * Generated from protobuf field <code>repeated string leading_detached_comments = 6;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getLeadingDetachedComments()
     {
@@ -369,7 +364,9 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated string leading_detached_comments = 6;</code>
+     * Generated from protobuf field <code>repeated string leading_detached_comments = 6;</code>
+     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setLeadingDetachedComments(&$var)
     {

+ 43 - 30
php/src/Google/Protobuf/Internal/UninterpretedOption.php

@@ -12,56 +12,52 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * A message representing a option the parser does not recognize. This only
  * appears in options protos created by the compiler::Parser class.
  * DescriptorPool resolves these when building Descriptor objects. Therefore,
  * options protos in descriptor objects (e.g. returned by Descriptor::options(),
  * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
  * in them.
- * </pre>
  *
- * Protobuf type <code>google.protobuf.UninterpretedOption</code>
+ * Generated from protobuf message <code>google.protobuf.UninterpretedOption</code>
  */
 class UninterpretedOption extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
      */
     private $name;
     private $has_name = false;
     /**
-     * <pre>
      * The value of the uninterpreted option, in whatever type the tokenizer
      * identified it as during parsing. Exactly one of these should be set.
-     * </pre>
      *
-     * <code>optional string identifier_value = 3;</code>
+     * Generated from protobuf field <code>optional string identifier_value = 3;</code>
      */
     private $identifier_value = '';
     private $has_identifier_value = false;
     /**
-     * <code>optional uint64 positive_int_value = 4;</code>
+     * Generated from protobuf field <code>optional uint64 positive_int_value = 4;</code>
      */
     private $positive_int_value = 0;
     private $has_positive_int_value = false;
     /**
-     * <code>optional int64 negative_int_value = 5;</code>
+     * Generated from protobuf field <code>optional int64 negative_int_value = 5;</code>
      */
     private $negative_int_value = 0;
     private $has_negative_int_value = false;
     /**
-     * <code>optional double double_value = 6;</code>
+     * Generated from protobuf field <code>optional double double_value = 6;</code>
      */
     private $double_value = 0.0;
     private $has_double_value = false;
     /**
-     * <code>optional bytes string_value = 7;</code>
+     * Generated from protobuf field <code>optional bytes string_value = 7;</code>
      */
     private $string_value = '';
     private $has_string_value = false;
     /**
-     * <code>optional string aggregate_value = 8;</code>
+     * Generated from protobuf field <code>optional string aggregate_value = 8;</code>
      */
     private $aggregate_value = '';
     private $has_aggregate_value = false;
@@ -72,7 +68,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
      */
     public function getName()
     {
@@ -80,7 +77,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
+     * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
+     * @param \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
      */
     public function setName(&$var)
     {
@@ -97,12 +96,11 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The value of the uninterpreted option, in whatever type the tokenizer
      * identified it as during parsing. Exactly one of these should be set.
-     * </pre>
      *
-     * <code>optional string identifier_value = 3;</code>
+     * Generated from protobuf field <code>optional string identifier_value = 3;</code>
+     * @return string
      */
     public function getIdentifierValue()
     {
@@ -110,12 +108,12 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <pre>
      * The value of the uninterpreted option, in whatever type the tokenizer
      * identified it as during parsing. Exactly one of these should be set.
-     * </pre>
      *
-     * <code>optional string identifier_value = 3;</code>
+     * Generated from protobuf field <code>optional string identifier_value = 3;</code>
+     * @param string $var
+     * @return $this
      */
     public function setIdentifierValue($var)
     {
@@ -132,7 +130,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional uint64 positive_int_value = 4;</code>
+     * Generated from protobuf field <code>optional uint64 positive_int_value = 4;</code>
+     * @return int|string
      */
     public function getPositiveIntValue()
     {
@@ -140,7 +139,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional uint64 positive_int_value = 4;</code>
+     * Generated from protobuf field <code>optional uint64 positive_int_value = 4;</code>
+     * @param int|string $var
+     * @return $this
      */
     public function setPositiveIntValue($var)
     {
@@ -157,7 +158,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int64 negative_int_value = 5;</code>
+     * Generated from protobuf field <code>optional int64 negative_int_value = 5;</code>
+     * @return int|string
      */
     public function getNegativeIntValue()
     {
@@ -165,7 +167,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional int64 negative_int_value = 5;</code>
+     * Generated from protobuf field <code>optional int64 negative_int_value = 5;</code>
+     * @param int|string $var
+     * @return $this
      */
     public function setNegativeIntValue($var)
     {
@@ -182,7 +186,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional double double_value = 6;</code>
+     * Generated from protobuf field <code>optional double double_value = 6;</code>
+     * @return float
      */
     public function getDoubleValue()
     {
@@ -190,7 +195,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional double double_value = 6;</code>
+     * Generated from protobuf field <code>optional double double_value = 6;</code>
+     * @param float $var
+     * @return $this
      */
     public function setDoubleValue($var)
     {
@@ -207,7 +214,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional bytes string_value = 7;</code>
+     * Generated from protobuf field <code>optional bytes string_value = 7;</code>
+     * @return string
      */
     public function getStringValue()
     {
@@ -215,7 +223,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional bytes string_value = 7;</code>
+     * Generated from protobuf field <code>optional bytes string_value = 7;</code>
+     * @param string $var
+     * @return $this
      */
     public function setStringValue($var)
     {
@@ -232,7 +242,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string aggregate_value = 8;</code>
+     * Generated from protobuf field <code>optional string aggregate_value = 8;</code>
+     * @return string
      */
     public function getAggregateValue()
     {
@@ -240,7 +251,9 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>optional string aggregate_value = 8;</code>
+     * Generated from protobuf field <code>optional string aggregate_value = 8;</code>
+     * @param string $var
+     * @return $this
      */
     public function setAggregateValue($var)
     {

+ 13 - 9
php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php

@@ -12,25 +12,23 @@ use Google\Protobuf\Internal\InputStream;
 use Google\Protobuf\Internal\GPBUtil;
 
 /**
- * <pre>
  * The name of the uninterpreted option.  Each string represents a segment in
  * a dot-separated name.  is_extension is true iff a segment represents an
  * extension (denoted with parentheses in options specs in .proto files).
  * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents
  * "foo.(bar.baz).qux".
- * </pre>
  *
- * Protobuf type <code>google.protobuf.UninterpretedOption.NamePart</code>
+ * Generated from protobuf message <code>google.protobuf.UninterpretedOption.NamePart</code>
  */
 class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
 {
     /**
-     * <code>required string name_part = 1;</code>
+     * Generated from protobuf field <code>required string name_part = 1;</code>
      */
     private $name_part = '';
     private $has_name_part = false;
     /**
-     * <code>required bool is_extension = 2;</code>
+     * Generated from protobuf field <code>required bool is_extension = 2;</code>
      */
     private $is_extension = false;
     private $has_is_extension = false;
@@ -41,7 +39,8 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>required string name_part = 1;</code>
+     * Generated from protobuf field <code>required string name_part = 1;</code>
+     * @return string
      */
     public function getNamePart()
     {
@@ -49,7 +48,9 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>required string name_part = 1;</code>
+     * Generated from protobuf field <code>required string name_part = 1;</code>
+     * @param string $var
+     * @return $this
      */
     public function setNamePart($var)
     {
@@ -66,7 +67,8 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>required bool is_extension = 2;</code>
+     * Generated from protobuf field <code>required bool is_extension = 2;</code>
+     * @return bool
      */
     public function getIsExtension()
     {
@@ -74,7 +76,9 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
     }
 
     /**
-     * <code>required bool is_extension = 2;</code>
+     * Generated from protobuf field <code>required bool is_extension = 2;</code>
+     * @param bool $var
+     * @return $this
      */
     public function setIsExtension($var)
     {

+ 337 - 0
php/tests/generated_phpdoc_test.php

@@ -0,0 +1,337 @@
+<?php
+
+require_once('generated/NoNamespaceEnum.php');
+require_once('generated/NoNamespaceMessage.php');
+require_once('test_base.php');
+require_once('test_util.php');
+
+use Foo\TestMessage;
+
+class GeneratedPhpdocTest extends TestBase
+{
+    public function testPhpDocForClass()
+    {
+        $class = new ReflectionClass('Foo\TestMessage');
+        $doc = $class->getDocComment();
+        $this->assertContains('foo.TestMessage', $doc);
+    }
+
+    /**
+     * @dataProvider providePhpDocForGettersAndSetters
+     */
+    public function testPhpDocForIntGetters($methods, $expectedDoc)
+    {
+        $class = new ReflectionClass('Foo\TestMessage');
+        foreach ($methods as $method) {
+            $doc = $class->getMethod($method)->getDocComment();
+            $this->assertContains($expectedDoc, $doc);
+        }
+    }
+
+    public function providePhpDocForGettersAndSetters()
+    {
+        return [
+            [
+                [
+                    'setOptionalInt32',
+                    'setOptionalUint32',
+                    'setOptionalSint32',
+                    'setOptionalFixed32',
+                    'setOptionalSfixed32',
+                    'setOneofInt32',
+                    'setOneofUint32',
+                    'setOneofSint32',
+                    'setOneofFixed32',
+                    'setOneofSfixed32',
+                    'setOptionalEnum',
+                    'setOptionalNoNamespaceEnum',
+                    'setOptionalNestedEnum',
+                    'setOneofEnum'
+                ],
+                '@param int $var'
+            ],
+            [
+                [
+                    'setOptionalInt64',
+                    'setOptionalUint64',
+                    'setOptionalSint64',
+                    'setOptionalFixed64',
+                    'setOptionalSfixed64',
+                    'setOneofInt64',
+                    'setOneofUint64',
+                    'setOneofSint64',
+                    'setOneofFixed64',
+                    'setOneofSfixed64',
+                ],
+                '@param int|string $var'
+            ],
+            [
+                [
+                    'getOptionalInt32',
+                    'getOptionalUint32',
+                    'getOptionalSint32',
+                    'getOptionalFixed32',
+                    'getOptionalSfixed32',
+                    'getOneofInt32',
+                    'getOneofUint32',
+                    'getOneofSint32',
+                    'getOneofFixed32',
+                    'getOneofSfixed32',
+                    'getOptionalEnum',
+                    'getOptionalNoNamespaceEnum',
+                    'getOptionalNestedEnum',
+                    'getOneofEnum',
+                ],
+                '@return int'
+            ],
+            [
+                [
+                    'setOptionalInt64',
+                    'setOptionalUint64',
+                    'setOptionalSint64',
+                    'setOptionalFixed64',
+                    'setOptionalSfixed64',
+                    'setOneofInt64',
+                    'setOneofUint64',
+                    'setOneofSint64',
+                    'setOneofFixed64',
+                    'setOneofSfixed64',
+                ],
+                '@param int|string $var'
+            ],
+            [
+                [
+                    'getRepeatedInt32',
+                    'getRepeatedInt64',
+                    'getRepeatedUint32',
+                    'getRepeatedUint64',
+                    'getRepeatedSint32',
+                    'getRepeatedSint64',
+                    'getRepeatedFixed32',
+                    'getRepeatedFixed64',
+                    'getRepeatedSfixed32',
+                    'getRepeatedSfixed64',
+                    'getRepeatedFloat',
+                    'getRepeatedDouble',
+                    'getRepeatedBool',
+                    'getRepeatedString',
+                    'getRepeatedBytes',
+                    'getRepeatedEnum',
+                    'getRepeatedMessage',
+                    'getRepeatedRecursive',
+                    'getRepeatedNoNamespaceMessage',
+                    'getRepeatedNoNamespaceEnum',
+                ],
+                '@return \Google\Protobuf\Internal\RepeatedField'
+            ],
+            [
+                [
+                    'getMapInt32Int32',
+                    'getMapInt64Int64',
+                    'getMapUint32Uint32',
+                    'getMapUint64Uint64',
+                    'getMapSint32Sint32',
+                    'getMapSint64Sint64',
+                    'getMapFixed32Fixed32',
+                    'getMapFixed64Fixed64',
+                    'getMapSfixed32Sfixed32',
+                    'getMapSfixed64Sfixed64',
+                    'getMapInt32Float',
+                    'getMapInt32Double',
+                    'getMapBoolBool',
+                    'getMapStringString',
+                    'getMapInt32Bytes',
+                    'getMapInt32Enum',
+                    'getMapInt32Message',
+                    'getMapRecursive',
+                ],
+                '@return \Google\Protobuf\Internal\MapField'
+            ],
+            [
+                [
+                    'setRepeatedInt32',
+                    'setRepeatedUint32',
+                    'setRepeatedSint32',
+                    'setRepeatedFixed32',
+                    'setRepeatedSfixed32',
+                    'setRepeatedEnum',
+                    'setRepeatedNoNamespaceEnum',
+                ],
+                '@param int[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setRepeatedInt64',
+                    'setRepeatedUint64',
+                    'setRepeatedSint64',
+                    'setRepeatedFixed64',
+                    'setRepeatedSfixed64',
+                ],
+                '@param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setRepeatedFloat',
+                    'setRepeatedDouble',
+                ],
+                '@param float[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setRepeatedBool',
+                ],
+                '@param bool[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setRepeatedString',
+                    'setRepeatedBytes',
+                ],
+                '@param string[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setRepeatedMessage',
+                ],
+                '@param \Foo\TestMessage_Sub[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setRepeatedRecursive',
+                ],
+                '@param \Foo\TestMessage[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setRepeatedNoNamespaceMessage',
+                ],
+                '@param \NoNamespaceMessage[]|\Google\Protobuf\Internal\RepeatedField $var'
+            ],
+            [
+                [
+                    'setMapInt32Int32',
+                    'setMapInt64Int64',
+                    'setMapUint32Uint32',
+                    'setMapUint64Uint64',
+                    'setMapSint32Sint32',
+                    'setMapSint64Sint64',
+                    'setMapFixed32Fixed32',
+                    'setMapFixed64Fixed64',
+                    'setMapSfixed32Sfixed32',
+                    'setMapSfixed64Sfixed64',
+                    'setMapInt32Float',
+                    'setMapInt32Double',
+                    'setMapBoolBool',
+                    'setMapStringString',
+                    'setMapInt32Bytes',
+                    'setMapInt32Enum',
+                    'setMapInt32Message',
+                    'setMapRecursive',
+                ],
+                '@param array|\Google\Protobuf\Internal\MapField $var'
+            ],
+            [
+                [
+                    'getOptionalFloat',
+                    'getOptionalDouble',
+                    'getOneofDouble',
+                    'getOneofFloat',
+                ],
+                '@return float'
+            ],
+            [
+                [
+                    'setOptionalFloat',
+                    'setOptionalDouble',
+                    'setOneofDouble',
+                    'setOneofFloat',
+                ],
+                '@param float $var'
+            ],
+            [
+                [
+                    'getOptionalBool',
+                    'getOneofBool',
+                ],
+                '@return bool'],
+            [
+                [
+                    'setOptionalBool',
+                    'setOneofBool',
+                ],
+                '@param bool $var'
+            ],
+            [
+                [
+                    'getOptionalString',
+                    'getOptionalBytes',
+                    'getOneofString',
+                    'getOneofBytes',
+                    'getMyOneof',
+                ],
+                '@return string'
+            ],
+            [
+                [
+                    'setOptionalString',
+                    'setOptionalBytes',
+                    'setOneofString',
+                    'setOneofBytes',
+                ],
+                '@param string $var'
+            ],
+
+            [
+                [
+                    'getOptionalMessage',
+                    'getOneofMessage'
+                ],
+                '@return \Foo\TestMessage_Sub'
+            ],
+            [
+                [
+                    'setOptionalMessage',
+                    'setOneofMessage'
+                ],
+                '@param \Foo\TestMessage_Sub $var'
+            ],
+            [
+                [
+                    'getOptionalIncludedMessage'
+                ],
+                '@return \Bar\TestInclude'
+            ],
+            [
+                [
+                    'setOptionalIncludedMessage'
+                ],
+                '@param \Bar\TestInclude $var'
+            ],
+            [
+                [
+                    'getRecursive'
+                ],
+                '@return \Foo\TestMessage'
+            ],
+            [
+                [
+                    'setRecursive'
+                ],
+                '@param \Foo\TestMessage $var'
+            ],
+
+            [
+                [
+                    'getOptionalNoNamespaceMessage'
+                ],
+                '@return \NoNamespaceMessage'
+            ],
+            [
+                [
+                    'setOptionalNoNamespaceMessage'
+                ],
+                '@param \NoNamespaceMessage $var'
+            ],
+        ];
+    }
+}

+ 1 - 1
php/tests/test.sh

@@ -8,7 +8,7 @@ set -e
 phpize && ./configure CFLAGS='-g -O0' && make
 popd
 
-tests=( array_test.php encode_decode_test.php generated_class_test.php map_field_test.php well_known_test.php )
+tests=( array_test.php encode_decode_test.php generated_class_test.php generated_phpdoc_test.php map_field_test.php well_known_test.php )
 
 for t in "${tests[@]}"
 do

+ 120 - 39
src/google/protobuf/compiler/php/php_generator.cc

@@ -51,6 +51,9 @@ const std::string kDescriptorDirName = "Google/Protobuf/Internal";
 const std::string kDescriptorPackageName = "Google\\Protobuf\\Internal";
 const char* const kReservedNames[] = {"ARRAY", "Empty", "ECHO"};
 const int kReservedNamesSize = 3;
+const int kFieldSetter = 1;
+const int kFieldGetter = 2;
+const int kFieldProperty = 3;
 
 namespace google {
 namespace protobuf {
@@ -71,10 +74,12 @@ std::string EscapeDollor(const string& to_escape);
 std::string BinaryToHex(const string& binary);
 void Indent(io::Printer* printer);
 void Outdent(io::Printer* printer);
-void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message);
-void GenerateFieldDocComment(io::Printer* printer,
-                             const FieldDescriptor* field);
-void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_);
+void GenerateMessageDocComment(io::Printer* printer, const Descriptor* message,
+                               int is_descriptor);
+void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field,
+                             int is_descriptor, int function_type);
+void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_,
+                            int is_descriptor);
 void GenerateEnumValueDocComment(io::Printer* printer,
                                  const EnumValueDescriptor* value);
 
@@ -306,6 +311,87 @@ std::string TypeName(const FieldDescriptor* field) {
   }
 }
 
+std::string PhpSetterTypeName(const FieldDescriptor* field, bool is_descriptor) {
+  if (field->is_map()) {
+    return "array|\\Google\\Protobuf\\Internal\\MapField";
+  }
+  string type;
+  switch (field->type()) {
+    case FieldDescriptor::TYPE_INT32:
+    case FieldDescriptor::TYPE_UINT32:
+    case FieldDescriptor::TYPE_SINT32:
+    case FieldDescriptor::TYPE_FIXED32:
+    case FieldDescriptor::TYPE_SFIXED32:
+    case FieldDescriptor::TYPE_ENUM:
+      type = "int";
+      break;
+    case FieldDescriptor::TYPE_INT64:
+    case FieldDescriptor::TYPE_UINT64:
+    case FieldDescriptor::TYPE_SINT64:
+    case FieldDescriptor::TYPE_FIXED64:
+    case FieldDescriptor::TYPE_SFIXED64:
+      type = "int|string";
+      break;
+    case FieldDescriptor::TYPE_DOUBLE:
+    case FieldDescriptor::TYPE_FLOAT:
+      type = "float";
+      break;
+    case FieldDescriptor::TYPE_BOOL:
+      type = "bool";
+      break;
+    case FieldDescriptor::TYPE_STRING:
+    case FieldDescriptor::TYPE_BYTES:
+      type = "string";
+      break;
+    case FieldDescriptor::TYPE_MESSAGE:
+      type = "\\" + FullClassName(field->message_type(), is_descriptor);
+      break;
+    case FieldDescriptor::TYPE_GROUP:
+      return "null";
+    default: assert(false); return "";
+  }
+  if (field->is_repeated()) {
+    // accommodate for edge case with multiple types.
+    size_t start_pos = type.find("|");
+    if (start_pos != std::string::npos) {
+      type.replace(start_pos, 1, "[]|");
+    }
+    type += "[]|\\Google\\Protobuf\\Internal\\RepeatedField";
+  }
+  return type;
+}
+
+std::string PhpGetterTypeName(const FieldDescriptor* field, bool is_descriptor) {
+  if (field->is_map()) {
+    return "\\Google\\Protobuf\\Internal\\MapField";
+  }
+  if (field->is_repeated()) {
+    return "\\Google\\Protobuf\\Internal\\RepeatedField";
+  }
+  switch (field->type()) {
+    case FieldDescriptor::TYPE_INT32:
+    case FieldDescriptor::TYPE_UINT32:
+    case FieldDescriptor::TYPE_SINT32:
+    case FieldDescriptor::TYPE_FIXED32:
+    case FieldDescriptor::TYPE_SFIXED32:
+    case FieldDescriptor::TYPE_ENUM: return "int";
+    case FieldDescriptor::TYPE_INT64:
+    case FieldDescriptor::TYPE_UINT64:
+    case FieldDescriptor::TYPE_SINT64:
+    case FieldDescriptor::TYPE_FIXED64:
+    case FieldDescriptor::TYPE_SFIXED64: return "int|string";
+    case FieldDescriptor::TYPE_DOUBLE:
+    case FieldDescriptor::TYPE_FLOAT: return "float";
+    case FieldDescriptor::TYPE_BOOL: return "bool";
+    case FieldDescriptor::TYPE_STRING:
+    case FieldDescriptor::TYPE_BYTES: return "string";
+    case FieldDescriptor::TYPE_MESSAGE:
+      return "\\" + FullClassName(field->message_type(), is_descriptor);
+    case FieldDescriptor::TYPE_GROUP: return "null";
+    default: assert(false); return "";
+  }
+}
+
 std::string EnumOrMessageSuffix(
     const FieldDescriptor* field, bool is_descriptor) {
   if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
@@ -390,7 +476,7 @@ void Outdent(io::Printer* printer) {
 void GenerateField(const FieldDescriptor* field, io::Printer* printer,
                    bool is_descriptor) {
   if (field->is_repeated()) {
-    GenerateFieldDocComment(printer, field);
+    GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty);
     printer->Print(
         "private $^name^;\n",
         "name", field->name());
@@ -398,7 +484,7 @@ void GenerateField(const FieldDescriptor* field, io::Printer* printer,
     // Oneof fields are handled by GenerateOneofField.
     return;
   } else {
-    GenerateFieldDocComment(printer, field);
+    GenerateFieldDocComment(printer, field, is_descriptor, kFieldProperty);
     printer->Print(
         "private $^name^ = ^default^;\n",
         "name", field->name(),
@@ -426,7 +512,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
 
   // Generate getter.
   if (oneof != NULL) {
-    GenerateFieldDocComment(printer, field);
+    GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter);
     printer->Print(
         "public function get^camel_name^()\n"
         "{\n"
@@ -435,7 +521,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
         "camel_name", UnderscoresToCamelCase(field->name(), true),
         "number", IntToString(field->number()));
   } else {
-    GenerateFieldDocComment(printer, field);
+    GenerateFieldDocComment(printer, field, is_descriptor, kFieldGetter);
     printer->Print(
         "public function get^camel_name^()\n"
         "{\n"
@@ -446,7 +532,7 @@ void GenerateFieldAccessor(const FieldDescriptor* field, bool is_descriptor,
   }
 
   // Generate setter.
-  GenerateFieldDocComment(printer, field);
+  GenerateFieldDocComment(printer, field, is_descriptor, kFieldSetter);
   printer->Print(
       "public function set^camel_name^(^var^)\n"
       "{\n",
@@ -844,7 +930,7 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
         "name", fullname.substr(0, lastindex));
   }
 
-  GenerateEnumDocComment(&printer, en);
+  GenerateEnumDocComment(&printer, en, is_descriptor);
 
   if (lastindex != string::npos) {
     printer.Print(
@@ -905,7 +991,7 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
 
   GenerateUseDeclaration(is_descriptor, &printer);
 
-  GenerateMessageDocComment(&printer, message);
+  GenerateMessageDocComment(&printer, message, is_descriptor);
   if (lastindex != string::npos) {
     printer.Print(
         "class ^name^ extends \\Google\\Protobuf\\Internal\\Message\n"
@@ -953,6 +1039,9 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
   for (int i = 0; i < message->oneof_decl_count(); i++) {
     const OneofDescriptor* oneof = message->oneof_decl(i);
     printer.Print(
+      "/**\n"
+      " * @return string\n"
+      " */\n"
       "public function get^camel_name^()\n"
       "{\n"
       "    return $this->whichOneof(\"^name^\");\n"
@@ -1019,22 +1108,6 @@ static string EscapePhpdoc(const string& input) {
         // does not have a corresponding @Deprecated annotation.
         result.append("&#64;");
         break;
-      case '<':
-        // Avoid interpretation as HTML.
-        result.append("&lt;");
-        break;
-      case '>':
-        // Avoid interpretation as HTML.
-        result.append("&gt;");
-        break;
-      case '&':
-        // Avoid interpretation as HTML.
-        result.append("&amp;");
-        break;
-      case '\\':
-        // Java interprets Unicode escape sequences anywhere!
-        result.append("&#92;");
-        break;
       default:
         result.push_back(c);
         break;
@@ -1053,7 +1126,7 @@ static void GenerateDocCommentBodyForLocation(
   if (!comments.empty()) {
     // TODO(teboring):  Ideally we should parse the comment text as Markdown and
     //   write it back as HTML, but this requires a Markdown parser.  For now
-    //   we just use <pre> to get fixed-width text formatting.
+    //   we just use the proto comments unchanged.
 
     // If the comment itself contains block comment start or end markers,
     // HTML-escape them so that they don't accidentally close the doc comment.
@@ -1064,7 +1137,6 @@ static void GenerateDocCommentBodyForLocation(
       lines.pop_back();
     }
 
-    printer->Print(" * <pre>\n");
     for (int i = 0; i < lines.size(); i++) {
       // Most lines should start with a space.  Watch out for lines that start
       // with a /, since putting that right after the leading asterisk will
@@ -1076,7 +1148,6 @@ static void GenerateDocCommentBodyForLocation(
       }
     }
     printer->Print(
-        " * </pre>\n"
         " *\n");
   }
 }
@@ -1102,17 +1173,18 @@ static string FirstLineOf(const string& value) {
 }
 
 void GenerateMessageDocComment(io::Printer* printer,
-                               const Descriptor* message) {
+                               const Descriptor* message, int is_descriptor) {
   printer->Print("/**\n");
   GenerateDocCommentBody(printer, message);
   printer->Print(
-    " * Protobuf type <code>^fullname^</code>\n"
+    " * Generated from protobuf message <code>^messagename^</code>\n"
     " */\n",
-    "fullname", EscapePhpdoc(message->full_name()));
+    "fullname", EscapePhpdoc(PhpName(message->full_name(), is_descriptor)),
+    "messagename", EscapePhpdoc(message->full_name()));
 }
 
-void GenerateFieldDocComment(io::Printer* printer,
-                             const FieldDescriptor* field) {
+void GenerateFieldDocComment(io::Printer* printer, const FieldDescriptor* field,
+                             int is_descriptor, int function_type) {
   // In theory we should have slightly different comments for setters, getters,
   // etc., but in practice everyone already knows the difference between these
   // so it's redundant information.
@@ -1124,18 +1196,27 @@ void GenerateFieldDocComment(io::Printer* printer,
   printer->Print("/**\n");
   GenerateDocCommentBody(printer, field);
   printer->Print(
-    " * <code>^def^</code>\n",
+    " * Generated from protobuf field <code>^def^</code>\n",
     "def", EscapePhpdoc(FirstLineOf(field->DebugString())));
+  if (function_type == kFieldSetter) {
+    printer->Print(" * @param ^php_type^ $var\n",
+      "php_type", PhpSetterTypeName(field, is_descriptor));
+    printer->Print(" * @return $this\n");
+  } else if (function_type == kFieldGetter) {
+    printer->Print(" * @return ^php_type^\n",
+      "php_type", PhpGetterTypeName(field, is_descriptor));
+  }
   printer->Print(" */\n");
 }
 
-void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_) {
+void GenerateEnumDocComment(io::Printer* printer, const EnumDescriptor* enum_,
+                            int is_descriptor) {
   printer->Print("/**\n");
   GenerateDocCommentBody(printer, enum_);
   printer->Print(
     " * Protobuf enum <code>^fullname^</code>\n"
     " */\n",
-    "fullname", EscapePhpdoc(enum_->full_name()));
+    "fullname", EscapePhpdoc(PhpName(enum_->full_name(), is_descriptor)));
 }
 
 void GenerateEnumValueDocComment(io::Printer* printer,
@@ -1143,7 +1224,7 @@ void GenerateEnumValueDocComment(io::Printer* printer,
   printer->Print("/**\n");
   GenerateDocCommentBody(printer, value);
   printer->Print(
-    " * <code>^def^</code>\n"
+    " * Generated from protobuf enum <code>^def^</code>\n"
     " */\n",
     "def", EscapePhpdoc(FirstLineOf(value->DebugString())));
 }