diff options
Diffstat (limited to 'php/src/Google')
25 files changed, 145 insertions, 96 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php index f076f6be..948c5876 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -117,8 +117,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setField(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->field = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->field = $arr; $this->has_field = true; } @@ -140,8 +140,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setExtension(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->extension = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->extension = $arr; $this->has_extension = true; } @@ -163,8 +163,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setNestedType(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); - $this->nested_type = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); + $this->nested_type = $arr; $this->has_nested_type = true; } @@ -186,8 +186,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setEnumType(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); - $this->enum_type = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); + $this->enum_type = $arr; $this->has_enum_type = true; } @@ -209,8 +209,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setExtensionRange(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); - $this->extension_range = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class); + $this->extension_range = $arr; $this->has_extension_range = true; } @@ -232,8 +232,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setOneofDecl(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); - $this->oneof_decl = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class); + $this->oneof_decl = $arr; $this->has_oneof_decl = true; } @@ -278,8 +278,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setReservedRange(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); - $this->reserved_range = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class); + $this->reserved_range = $arr; $this->has_reserved_range = true; } @@ -311,8 +311,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message */ public function setReservedName(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->reserved_name = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->reserved_name = $arr; $this->has_reserved_name = true; } diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php index 9c5f245b..73f6edbd 100644 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -77,8 +77,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setValue(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); - $this->value = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class); + $this->value = $arr; $this->has_value = true; } diff --git a/php/src/Google/Protobuf/Internal/EnumOptions.php b/php/src/Google/Protobuf/Internal/EnumOptions.php index a9c4e0d7..4fa0bce7 100644 --- a/php/src/Google/Protobuf/Internal/EnumOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumOptions.php @@ -144,8 +144,8 @@ class EnumOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/php/src/Google/Protobuf/Internal/EnumValueOptions.php index 6446ecd4..232a6738 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -101,8 +101,8 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php index 06f26015..a3cd8ef9 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto +namespace Google\Protobuf\Internal; + /** * Protobuf enum <code>google.protobuf.FieldDescriptorProto.Label</code> */ -namespace Google\Protobuf\Internal; - class FieldDescriptorProto_Label { /** diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php index 9bda76c2..8335f9b1 100644 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto +namespace Google\Protobuf\Internal; + /** * Protobuf enum <code>google.protobuf.FieldDescriptorProto.Type</code> */ -namespace Google\Protobuf\Internal; - class FieldDescriptorProto_Type { /** @@ -63,6 +63,9 @@ class FieldDescriptorProto_Type /** * <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> diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php index af1393a5..8db7ed67 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -415,8 +415,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php index 2ff2a478..f59f20be 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto +namespace Google\Protobuf\Internal; + /** * Protobuf enum <code>google.protobuf.FieldOptions.CType</code> */ -namespace Google\Protobuf\Internal; - class FieldOptions_CType { /** diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php index 541c8ae5..0c6995b7 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php @@ -2,11 +2,11 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto +namespace Google\Protobuf\Internal; + /** * Protobuf enum <code>google.protobuf.FieldOptions.JSType</code> */ -namespace Google\Protobuf\Internal; - class FieldOptions_JSType { /** diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php index 39f67768..0363d9e9 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -206,8 +206,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setDependency(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->dependency = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->dependency = $arr; $this->has_dependency = true; } @@ -237,8 +237,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setPublicDependency(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->public_dependency = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->public_dependency = $arr; $this->has_public_dependency = true; } @@ -270,8 +270,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setWeakDependency(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->weak_dependency = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->weak_dependency = $arr; $this->has_weak_dependency = true; } @@ -301,8 +301,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setMessageType(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); - $this->message_type = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class); + $this->message_type = $arr; $this->has_message_type = true; } @@ -324,8 +324,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setEnumType(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); - $this->enum_type = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class); + $this->enum_type = $arr; $this->has_enum_type = true; } @@ -347,8 +347,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setService(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); - $this->service = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class); + $this->service = $arr; $this->has_service = true; } @@ -370,8 +370,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setExtension(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); - $this->extension = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class); + $this->extension = $arr; $this->has_extension = true; } diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php index 20a165c4..0bcc8051 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -45,8 +45,8 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message */ public function setFile(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); - $this->file = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class); + $this->file = $arr; $this->has_file = true; } diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 2422f3ee..22653a4f 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -178,6 +178,16 @@ class FileOptions extends \Google\Protobuf\Internal\Message 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> + */ + private $php_class_prefix = ''; + private $has_php_class_prefix = false; + /** + * <pre> * The parser stores options it doesn't recognize here. See above. * </pre> * @@ -708,6 +718,39 @@ 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> + */ + public function getPhpClassPrefix() + { + return $this->php_class_prefix; + } + + /** + * <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> + */ + public function setPhpClassPrefix($var) + { + GPBUtil::checkString($var, True); + $this->php_class_prefix = $var; + $this->has_php_class_prefix = true; + } + + public function hasPhpClassPrefix() + { + return $this->has_php_class_prefix; + } + + /** + * <pre> * The parser stores options it doesn't recognize here. See above. * </pre> * @@ -727,8 +770,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php index 7fd488eb..b550e7f1 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php +++ b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php @@ -2,6 +2,8 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto +namespace Google\Protobuf\Internal; + /** * <pre> * Generated classes can be optimized for speed or code size. @@ -9,8 +11,6 @@ * * Protobuf enum <code>google.protobuf.FileOptions.OptimizeMode</code> */ -namespace Google\Protobuf\Internal; - class FileOptions_OptimizeMode { /** diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php index 8e493c2f..450854f1 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php @@ -61,8 +61,8 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message */ public function setAnnotation(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class); - $this->annotation = $var; + $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 dcc7edfe..ed22cc38 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php @@ -85,8 +85,8 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message */ public function setPath(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->path = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $arr; $this->has_path = true; } diff --git a/php/src/Google/Protobuf/Internal/MessageOptions.php b/php/src/Google/Protobuf/Internal/MessageOptions.php index e4a214cb..747f3294 100644 --- a/php/src/Google/Protobuf/Internal/MessageOptions.php +++ b/php/src/Google/Protobuf/Internal/MessageOptions.php @@ -320,8 +320,8 @@ class MessageOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/MethodOptions.php b/php/src/Google/Protobuf/Internal/MethodOptions.php index 3325e52b..6dca5854 100644 --- a/php/src/Google/Protobuf/Internal/MethodOptions.php +++ b/php/src/Google/Protobuf/Internal/MethodOptions.php @@ -129,8 +129,8 @@ class MethodOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php index 62768b5c..ce4adfe7 100644 --- a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php +++ b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php @@ -2,6 +2,8 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/descriptor.proto +namespace Google\Protobuf\Internal; + /** * <pre> * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, @@ -11,8 +13,6 @@ * * Protobuf enum <code>google.protobuf.MethodOptions.IdempotencyLevel</code> */ -namespace Google\Protobuf\Internal; - class MethodOptions_IdempotencyLevel { /** diff --git a/php/src/Google/Protobuf/Internal/OneofOptions.php b/php/src/Google/Protobuf/Internal/OneofOptions.php index 083d9929..b61325d2 100644 --- a/php/src/Google/Protobuf/Internal/OneofOptions.php +++ b/php/src/Google/Protobuf/Internal/OneofOptions.php @@ -52,8 +52,8 @@ class OneofOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php index 624bde84..47776202 100644 --- a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php @@ -77,8 +77,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message */ public function setMethod(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); - $this->method = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class); + $this->method = $arr; $this->has_method = true; } diff --git a/php/src/Google/Protobuf/Internal/ServiceOptions.php b/php/src/Google/Protobuf/Internal/ServiceOptions.php index 5f3564e4..62323dba 100644 --- a/php/src/Google/Protobuf/Internal/ServiceOptions.php +++ b/php/src/Google/Protobuf/Internal/ServiceOptions.php @@ -101,8 +101,8 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message */ public function setUninterpretedOption(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); - $this->uninterpreted_option = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; $this->has_uninterpreted_option = true; } diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php index d2352ddd..eab60880 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -177,8 +177,8 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message */ public function setLocation(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class); - $this->location = $var; + $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 d1bdb166..5a02b26c 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php @@ -179,8 +179,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message */ public function setPath(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->path = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $arr; $this->has_path = true; } @@ -218,8 +218,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message */ public function setSpan(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->span = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->span = $arr; $this->has_span = true; } @@ -365,8 +365,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message */ public function setLeadingDetachedComments(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->leading_detached_comments = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->leading_detached_comments = $arr; $this->has_leading_detached_comments = true; } diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php index c0f48310..28655019 100644 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -84,8 +84,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message */ public function setName(&$var) { - GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); - $this->name = $var; + $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/descriptor.php b/php/src/Google/Protobuf/descriptor.php index 9e56ef27..2263af6e 100644 --- a/php/src/Google/Protobuf/descriptor.php +++ b/php/src/Google/Protobuf/descriptor.php @@ -78,14 +78,14 @@ class FileDescriptor $file->setPackage($proto->getPackage()); foreach ($proto->getMessageType() as $message_proto) { $file->addMessageType(Descriptor::buildFromProto( - $message_proto, $file->getPackage(), "")); + $message_proto, $proto, "")); } foreach ($proto->getEnumType() as $enum_proto) { $file->getEnumType()[] = $file->addEnumType( EnumDescriptor::buildFromProto( $enum_proto, - $file->getPackage(), + $proto, "")); } return $file; @@ -182,7 +182,7 @@ class Descriptor return $this->options; } - public static function buildFromProto($proto, $package, $containing) + public static function buildFromProto($proto, $file_proto, $containing) { $desc = new Descriptor(); @@ -192,7 +192,7 @@ class Descriptor getFullClassName( $proto, $containing, - $package, + $file_proto, $message_name_without_package, $classname, $fullname); @@ -207,7 +207,7 @@ class Descriptor // Handle nested types. foreach ($proto->getNestedType() as $nested_proto) { $desc->addNestedType(Descriptor::buildFromProto( - $nested_proto, $package, $message_name_without_package)); + $nested_proto, $file_proto, $message_name_without_package)); } // Handle oneof fields. @@ -220,43 +220,46 @@ class Descriptor } } -function addPrefixIfSpecial( +function getClassNameWithoutPackage( $name, - $package) + $file_proto) { - if ($name === "Empty" && $package === "google.protobuf") { + if ($name === "Empty" && $file_proto->getPackage() === "google.protobuf") { return "GPBEmpty"; } else { - return $name; + $option = $file_proto->getOptions(); + $prefix = is_null($option) ? "" : $option->getPhpClassPrefix(); + // Nested message class names are seperated by '_', and package names + // are seperated by '\'. + return $prefix . implode('_', array_map('ucwords', + explode('.', $name))); } } function getFullClassName( $proto, $containing, - $package, + $file_proto, &$message_name_without_package, &$classname, &$fullname) { // Full name needs to start with '.'. - $message_name_without_package = - addPrefixIfSpecial($proto->getName(), $package); + $message_name_without_package = $proto->getName(); if ($containing !== "") { $message_name_without_package = $containing . "." . $message_name_without_package; } + + $package = $file_proto->getPackage(); if ($package === "") { $fullname = "." . $message_name_without_package; } else { $fullname = "." . $package . "." . $message_name_without_package; } - // Nested message class names are seperated by '_', and package names are - // seperated by '\'. $class_name_without_package = - implode('_', array_map('ucwords', - explode('.', $message_name_without_package))); + getClassNameWithoutPackage($message_name_without_package, $file_proto); if ($package === "") { $classname = $class_name_without_package; } else { @@ -333,7 +336,7 @@ class EnumDescriptor return $this->klass; } - public static function buildFromProto($proto, $package, $containing) + public static function buildFromProto($proto, $file_proto, $containing) { $desc = new EnumDescriptor(); @@ -343,7 +346,7 @@ class EnumDescriptor getFullClassName( $proto, $containing, - $package, + $file_proto, $enum_name_without_package, $classname, $fullname); |