diff options
author | Brent Shaffer <betterbrent@google.com> | 2018-05-23 16:43:30 -0700 |
---|---|---|
committer | Paul Yang <TeBoring@users.noreply.github.com> | 2018-05-24 13:39:41 -0700 |
commit | 6737954661ed26105dd87a4c78fe3f333c978961 (patch) | |
tree | a0bd8f91dfde4576790961e6896a5fa20ceba019 /php/src/Google/Protobuf/Internal | |
parent | 839f71e30567498284061ea92a9f1a5216b46e14 (diff) |
PHP namespaces for nested messages and enums (#4536)
* uses namespaces for nested messages and enums
* fixes namespaces for PHP dist
* fixes namespace for Descriptors, adds Cardinality and Kind
* fixes nested namespaces for reserved words and adds tests
* adds tests and generator fix for php class prefixes
* fixes escaping of protobuf packages, enum comments, misc others
* nice refactor of generated code
* adds class files for backwards compatibility
* simplifies code with templates
* adds compatibility files to makefile
* cleanup of generator and fixes nested namespace bug
* regenerates proto types
* remove internal BC classes
* adds deprecated warning, adds methods back
* simplifies if statement
* fixes dist files
* addresses review comments
* adds back TYPE_URL_PREFIX constant
* adds @deprecated to old nested class files
* skips tests which require a separate process when protobuf.so is enabled
* Adds tests for legacy nested classes that do not require separate processes to test
* uses legacy names for GPBUtil message check
* adds block for IDE @deprecated message
* Namespace for nested message/enum in c extension
* Remove unused code
Diffstat (limited to 'php/src/Google/Protobuf/Internal')
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorProto.php | 12 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php (renamed from php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php) | 7 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php (renamed from php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php) | 7 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/EnumDescriptorProto.php | 6 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php (renamed from php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php) | 7 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php (renamed from php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php) | 9 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php (renamed from php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php) | 9 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/FieldOptions/CType.php (renamed from php/src/Google/Protobuf/Internal/FieldOptions_CType.php) | 9 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/FieldOptions/JSType.php (renamed from php/src/Google/Protobuf/Internal/FieldOptions_JSType.php) | 9 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/FileOptions.php | 8 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php (renamed from php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php) | 9 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/GPBUtil.php | 18 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php | 6 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php (renamed from php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php) | 7 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php (renamed from php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php) | 9 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/SourceCodeInfo.php | 6 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php (renamed from php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php) | 7 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/UninterpretedOption.php | 6 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php (renamed from php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php) | 7 |
19 files changed, 105 insertions, 53 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php index 4676269e..3b215d52 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -82,10 +82,10 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension * @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $nested_type * @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type - * @type \Google\Protobuf\Internal\DescriptorProto_ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $extension_range + * @type \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $extension_range * @type \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $oneof_decl * @type \Google\Protobuf\Internal\MessageOptions $options - * @type \Google\Protobuf\Internal\DescriptorProto_ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range + * @type \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range * @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name * Reserved field names, which may not be used by fields in the same message. * A given name may only be reserved once. @@ -247,12 +247,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message /** * 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 + * @param \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setExtensionRange($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ExtensionRange::class); $this->extension_range = $arr; $this->has_extension_range = true; @@ -331,12 +331,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message /** * 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 + * @param \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setReservedRange($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ReservedRange::class); $this->reserved_range = $arr; $this->has_reserved_range = true; diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php index d926ee6e..c06a0a6e 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\DescriptorProto; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBWire; @@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil; /** * Generated from protobuf message <code>google.protobuf.DescriptorProto.ExtensionRange</code> */ -class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message +class ExtensionRange extends \Google\Protobuf\Internal\Message { /** * Generated from protobuf field <code>optional int32 start = 1;</code> @@ -133,3 +133,6 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ExtensionRange::class, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); + diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php index 302eaaa9..73c964fa 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\DescriptorProto; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBWire; @@ -17,7 +17,7 @@ use Google\Protobuf\Internal\GPBUtil; * * Generated from protobuf message <code>google.protobuf.DescriptorProto.ReservedRange</code> */ -class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message +class ReservedRange extends \Google\Protobuf\Internal\Message { /** * Inclusive. @@ -117,3 +117,6 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ReservedRange::class, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); + diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php index 406bb5b5..da30fa99 100644 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -59,7 +59,7 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message * @type string $name * @type \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $value * @type \Google\Protobuf\Internal\EnumOptions $options - * @type \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range + * @type \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range * Range of reserved numeric values. Reserved numeric values may not be used * by enum values in the same enum declaration. Reserved ranges may not * overlap. @@ -176,12 +176,12 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message * overlap. * * Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;</code> - * @param \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setReservedRange($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange::class); $this->reserved_range = $arr; $this->has_reserved_range = true; diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php index 3d7b008e..e1079585 100644 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\EnumDescriptorProto; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBWire; @@ -19,7 +19,7 @@ use Google\Protobuf\Internal\GPBUtil; * * Generated from protobuf message <code>google.protobuf.EnumDescriptorProto.EnumReservedRange</code> */ -class EnumDescriptorProto_EnumReservedRange extends \Google\Protobuf\Internal\Message +class EnumReservedRange extends \Google\Protobuf\Internal\Message { /** * Inclusive. @@ -119,3 +119,6 @@ class EnumDescriptorProto_EnumReservedRange extends \Google\Protobuf\Internal\Me } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(EnumReservedRange::class, \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class); + diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php index f2a32fdf..b105088e 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php @@ -2,12 +2,12 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\FieldDescriptorProto; /** - * Protobuf enum <code>Google\Protobuf\Internal</code> + * Protobuf type <code>google.protobuf.FieldDescriptorProto.Label</code> */ -class FieldDescriptorProto_Label +class Label { /** * 0 is reserved for errors @@ -25,3 +25,6 @@ class FieldDescriptorProto_Label const LABEL_REPEATED = 3; } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Label::class, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class); + diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php index 1b022deb..ea228a77 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php @@ -2,12 +2,12 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\FieldDescriptorProto; /** - * Protobuf enum <code>Google\Protobuf\Internal</code> + * Protobuf type <code>google.protobuf.FieldDescriptorProto.Type</code> */ -class FieldDescriptorProto_Type +class Type { /** * 0 is reserved for errors. @@ -105,3 +105,6 @@ class FieldDescriptorProto_Type const TYPE_SINT64 = 18; } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Type::class, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class); + diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions/CType.php index 0f33072d..016197ac 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions/CType.php @@ -2,12 +2,12 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\FieldOptions; /** - * Protobuf enum <code>Google\Protobuf\Internal</code> + * Protobuf type <code>google.protobuf.FieldOptions.CType</code> */ -class FieldOptions_CType +class CType { /** * Default mode. @@ -25,3 +25,6 @@ class FieldOptions_CType const STRING_PIECE = 2; } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(CType::class, \Google\Protobuf\Internal\FieldOptions_CType::class); + diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php index 73bdf3f2..f7b78a1b 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php @@ -2,12 +2,12 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\FieldOptions; /** - * Protobuf enum <code>Google\Protobuf\Internal</code> + * Protobuf type <code>google.protobuf.FieldOptions.JSType</code> */ -class FieldOptions_JSType +class JSType { /** * Use the default type. @@ -29,3 +29,6 @@ class FieldOptions_JSType const JS_NUMBER = 2; } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(JSType::class, \Google\Protobuf\Internal\FieldOptions_JSType::class); + diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 2315ed5e..c6b36bbc 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -278,6 +278,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message * 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. + * @type string $php_metadata_namespace + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be used + * for determining the namespace. + * @type string $ruby_package + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. * @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. diff --git a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php index 4dd56ef8..3dd60bf6 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php +++ b/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php @@ -2,14 +2,14 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\FileOptions; /** * Generated classes can be optimized for speed or code size. * - * Protobuf enum <code>Google\Protobuf\Internal</code> + * Protobuf type <code>google.protobuf.FileOptions.OptimizeMode</code> */ -class FileOptions_OptimizeMode +class OptimizeMode { /** * Generate complete code for parsing, serialization, @@ -31,3 +31,6 @@ class FileOptions_OptimizeMode const LITE_RUNTIME = 3; } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(OptimizeMode::class, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class); + diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php index 05d5c393..023b07f4 100644 --- a/php/src/Google/Protobuf/Internal/GPBUtil.php +++ b/php/src/Google/Protobuf/Internal/GPBUtil.php @@ -191,7 +191,7 @@ class GPBUtil $var = boolval($var); } - public static function checkMessage(&$var, $klass) + public static function checkMessage(&$var, $klass, $newClass = null) { if (!$var instanceof $klass && !is_null($var)) { throw new \Exception("Expect $klass."); @@ -303,8 +303,11 @@ class GPBUtil $name, $file_proto) { - $classname = implode('_', explode('.', $name)); - return static::getClassNamePrefix($classname, $file_proto) . $classname; + $parts = explode('.', $name); + foreach ($parts as $i => $part) { + $parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i]; + } + return implode('\\', $parts); } public static function getFullClassName( @@ -347,9 +350,14 @@ class GPBUtil if ($package === "") { $classname = $class_name_without_package; } else { + $parts = array_map('ucwords', explode('.', $package)); + foreach ($parts as $i => $part) { + $parts[$i] = self::getClassNamePrefix($part, $file_proto).$part; + } $classname = - implode('\\', array_map('ucwords', explode('.', $package))). - "\\".$class_name_without_package; + implode('\\', $parts) . + "\\".self::getClassNamePrefix($class_name_without_package,$file_proto). + $class_name_without_package; } } diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php index c2b41a29..f5a65bea 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php @@ -34,7 +34,7 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotation + * @type \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotation * An Annotation connects some span of text in generated code to an element * of its generating .proto file. * } @@ -61,12 +61,12 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message * of its generating .proto file. * * Generated from protobuf field <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code> - * @param \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setAnnotation($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class); $this->annotation = $arr; $this->has_annotation = true; diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php index 75182007..09f958d2 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\GeneratedCodeInfo; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBWire; @@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil; /** * Generated from protobuf message <code>google.protobuf.GeneratedCodeInfo.Annotation</code> */ -class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message +class Annotation extends \Google\Protobuf\Internal\Message { /** * Identifies the element in the original source .proto file. This field @@ -211,3 +211,6 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Annotation::class, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); + diff --git a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php index 9e06d8ee..dcc30e27 100644 --- a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php +++ b/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php @@ -2,16 +2,16 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\MethodOptions; /** * 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. * - * Protobuf enum <code>Google\Protobuf\Internal</code> + * Protobuf type <code>google.protobuf.MethodOptions.IdempotencyLevel</code> */ -class MethodOptions_IdempotencyLevel +class IdempotencyLevel { /** * Generated from protobuf enum <code>IDEMPOTENCY_UNKNOWN = 0;</code> @@ -31,3 +31,6 @@ class MethodOptions_IdempotencyLevel const IDEMPOTENT = 2; } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(IdempotencyLevel::class, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class); + diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php index 2305a792..6e413f77 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -72,7 +72,7 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $location + * @type \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $location * 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 @@ -216,12 +216,12 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message * be recorded in the future. * * Generated from protobuf field <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code> - * @param \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLocation($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo\Location::class); $this->location = $arr; $this->has_location = true; diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php index f930aac1..bad247a1 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\SourceCodeInfo; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBWire; @@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil; /** * Generated from protobuf message <code>google.protobuf.SourceCodeInfo.Location</code> */ -class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message +class Location extends \Google\Protobuf\Internal\Message { /** * Identifies which part of the FileDescriptorProto was defined at this @@ -458,3 +458,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Location::class, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); + diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php index 36a18688..3b517ec5 100644 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -67,7 +67,7 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $name + * @type \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $name * @type string $identifier_value * The value of the uninterpreted option, in whatever type the tokenizer * identified it as during parsing. Exactly one of these should be set. @@ -94,12 +94,12 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code> - * @param \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $var + * @param \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setName($var) { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption\NamePart::class); $this->name = $arr; $this->has_name = true; diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php index d4369fda..92ee4b44 100644 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto -namespace Google\Protobuf\Internal; +namespace Google\Protobuf\Internal\UninterpretedOption; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\GPBWire; @@ -19,7 +19,7 @@ use Google\Protobuf\Internal\GPBUtil; * * Generated from protobuf message <code>google.protobuf.UninterpretedOption.NamePart</code> */ -class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message +class NamePart extends \Google\Protobuf\Internal\Message { /** * Generated from protobuf field <code>required string name_part = 1;</code> @@ -105,3 +105,6 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message } +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NamePart::class, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); + |