From 6737954661ed26105dd87a4c78fe3f333c978961 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 23 May 2018 16:43:30 -0700 Subject: 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 --- .../Google/Protobuf/Internal/DescriptorProto.php | 12 +- .../Internal/DescriptorProto/ExtensionRange.php | 138 ++++++ .../Internal/DescriptorProto/ReservedRange.php | 122 ++++++ .../Internal/DescriptorProto_ExtensionRange.php | 135 ------ .../Internal/DescriptorProto_ReservedRange.php | 119 ------ .../Protobuf/Internal/EnumDescriptorProto.php | 6 +- .../EnumDescriptorProto/EnumReservedRange.php | 124 ++++++ .../EnumDescriptorProto_EnumReservedRange.php | 121 ------ .../Internal/FieldDescriptorProto/Label.php | 30 ++ .../Internal/FieldDescriptorProto/Type.php | 110 +++++ .../Internal/FieldDescriptorProto_Label.php | 27 -- .../Internal/FieldDescriptorProto_Type.php | 107 ----- .../Protobuf/Internal/FieldOptions/CType.php | 30 ++ .../Protobuf/Internal/FieldOptions/JSType.php | 34 ++ .../Protobuf/Internal/FieldOptions_CType.php | 27 -- .../Protobuf/Internal/FieldOptions_JSType.php | 31 -- php/src/Google/Protobuf/Internal/FileOptions.php | 8 + .../Protobuf/Internal/FileOptions/OptimizeMode.php | 36 ++ .../Protobuf/Internal/FileOptions_OptimizeMode.php | 33 -- php/src/Google/Protobuf/Internal/GPBUtil.php | 18 +- .../Google/Protobuf/Internal/GeneratedCodeInfo.php | 6 +- .../Internal/GeneratedCodeInfo/Annotation.php | 216 ++++++++++ .../Internal/GeneratedCodeInfo_Annotation.php | 213 ---------- .../Internal/MethodOptions/IdempotencyLevel.php | 36 ++ .../Internal/MethodOptions_IdempotencyLevel.php | 33 -- .../Google/Protobuf/Internal/SourceCodeInfo.php | 6 +- .../Protobuf/Internal/SourceCodeInfo/Location.php | 463 +++++++++++++++++++++ .../Protobuf/Internal/SourceCodeInfo_Location.php | 460 -------------------- .../Protobuf/Internal/UninterpretedOption.php | 6 +- .../Internal/UninterpretedOption/NamePart.php | 110 +++++ .../Internal/UninterpretedOption_NamePart.php | 107 ----- 31 files changed, 1488 insertions(+), 1436 deletions(-) create mode 100644 php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php create mode 100644 php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php delete mode 100644 php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php delete mode 100644 php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php create mode 100644 php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php delete mode 100644 php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php create mode 100644 php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php create mode 100644 php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php delete mode 100644 php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php delete mode 100644 php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php create mode 100644 php/src/Google/Protobuf/Internal/FieldOptions/CType.php create mode 100644 php/src/Google/Protobuf/Internal/FieldOptions/JSType.php delete mode 100644 php/src/Google/Protobuf/Internal/FieldOptions_CType.php delete mode 100644 php/src/Google/Protobuf/Internal/FieldOptions_JSType.php create mode 100644 php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php delete mode 100644 php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php create mode 100644 php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php delete mode 100644 php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php create mode 100644 php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php delete mode 100644 php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php create mode 100644 php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php delete mode 100644 php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php create mode 100644 php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php delete mode 100644 php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php (limited to 'php/src/Google/Protobuf/Internal') 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 repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - * @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 repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - * @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 new file mode 100644 index 00000000..c06a0a6e --- /dev/null +++ b/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php @@ -0,0 +1,138 @@ +google.protobuf.DescriptorProto.ExtensionRange + */ +class ExtensionRange extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field optional int32 start = 1; + */ + private $start = 0; + private $has_start = false; + /** + * Generated from protobuf field optional int32 end = 2; + */ + private $end = 0; + private $has_end = false; + /** + * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; + */ + private $options = null; + private $has_options = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start + * @type int $end + * @type \Google\Protobuf\Internal\ExtensionRangeOptions $options + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field optional int32 start = 1; + * @return int + */ + public function getStart() + { + return $this->start; + } + + /** + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + $this->has_start = true; + + return $this; + } + + public function hasStart() + { + return $this->has_start; + } + + /** + * Generated from protobuf field optional int32 end = 2; + * @return int + */ + public function getEnd() + { + return $this->end; + } + + /** + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + + return $this; + } + + public function hasEnd() + { + return $this->has_end; + } + + /** + * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; + * @return \Google\Protobuf\Internal\ExtensionRangeOptions + */ + public function getOptions() + { + return $this->options; + } + + /** + * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; + * @param \Google\Protobuf\Internal\ExtensionRangeOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ExtensionRangeOptions::class); + $this->options = $var; + $this->has_options = true; + + return $this; + } + + public function hasOptions() + { + return $this->has_options; + } + +} + +// 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 new file mode 100644 index 00000000..73c964fa --- /dev/null +++ b/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php @@ -0,0 +1,122 @@ +google.protobuf.DescriptorProto.ReservedRange + */ +class ReservedRange extends \Google\Protobuf\Internal\Message +{ + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + */ + private $start = 0; + private $has_start = false; + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + */ + private $end = 0; + private $has_end = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start + * Inclusive. + * @type int $end + * Exclusive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @return int + */ + public function getStart() + { + return $this->start; + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + $this->has_start = true; + + return $this; + } + + public function hasStart() + { + return $this->has_start; + } + + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @return int + */ + public function getEnd() + { + return $this->end; + } + + /** + * Exclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + + return $this; + } + + public function hasEnd() + { + return $this->has_end; + } + +} + +// 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/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php deleted file mode 100644 index d926ee6e..00000000 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php +++ /dev/null @@ -1,135 +0,0 @@ -google.protobuf.DescriptorProto.ExtensionRange - */ -class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message -{ - /** - * Generated from protobuf field optional int32 start = 1; - */ - private $start = 0; - private $has_start = false; - /** - * Generated from protobuf field optional int32 end = 2; - */ - private $end = 0; - private $has_end = false; - /** - * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; - */ - private $options = null; - private $has_options = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $start - * @type int $end - * @type \Google\Protobuf\Internal\ExtensionRangeOptions $options - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct($data); - } - - /** - * Generated from protobuf field optional int32 start = 1; - * @return int - */ - public function getStart() - { - return $this->start; - } - - /** - * Generated from protobuf field optional int32 start = 1; - * @param int $var - * @return $this - */ - public function setStart($var) - { - GPBUtil::checkInt32($var); - $this->start = $var; - $this->has_start = true; - - return $this; - } - - public function hasStart() - { - return $this->has_start; - } - - /** - * Generated from protobuf field optional int32 end = 2; - * @return int - */ - public function getEnd() - { - return $this->end; - } - - /** - * Generated from protobuf field optional int32 end = 2; - * @param int $var - * @return $this - */ - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - - return $this; - } - - public function hasEnd() - { - return $this->has_end; - } - - /** - * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; - * @return \Google\Protobuf\Internal\ExtensionRangeOptions - */ - public function getOptions() - { - return $this->options; - } - - /** - * Generated from protobuf field optional .google.protobuf.ExtensionRangeOptions options = 3; - * @param \Google\Protobuf\Internal\ExtensionRangeOptions $var - * @return $this - */ - public function setOptions($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ExtensionRangeOptions::class); - $this->options = $var; - $this->has_options = true; - - return $this; - } - - public function hasOptions() - { - return $this->has_options; - } - -} - diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php deleted file mode 100644 index 302eaaa9..00000000 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php +++ /dev/null @@ -1,119 +0,0 @@ -google.protobuf.DescriptorProto.ReservedRange - */ -class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message -{ - /** - * Inclusive. - * - * Generated from protobuf field optional int32 start = 1; - */ - private $start = 0; - private $has_start = false; - /** - * Exclusive. - * - * Generated from protobuf field optional int32 end = 2; - */ - private $end = 0; - private $has_end = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $start - * Inclusive. - * @type int $end - * Exclusive. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct($data); - } - - /** - * Inclusive. - * - * Generated from protobuf field optional int32 start = 1; - * @return int - */ - public function getStart() - { - return $this->start; - } - - /** - * Inclusive. - * - * Generated from protobuf field optional int32 start = 1; - * @param int $var - * @return $this - */ - public function setStart($var) - { - GPBUtil::checkInt32($var); - $this->start = $var; - $this->has_start = true; - - return $this; - } - - public function hasStart() - { - return $this->has_start; - } - - /** - * Exclusive. - * - * Generated from protobuf field optional int32 end = 2; - * @return int - */ - public function getEnd() - { - return $this->end; - } - - /** - * Exclusive. - * - * Generated from protobuf field optional int32 end = 2; - * @param int $var - * @return $this - */ - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - - return $this; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - 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 repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; - * @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 new file mode 100644 index 00000000..e1079585 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php @@ -0,0 +1,124 @@ +google.protobuf.EnumDescriptorProto.EnumReservedRange + */ +class EnumReservedRange extends \Google\Protobuf\Internal\Message +{ + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + */ + private $start = 0; + private $has_start = false; + /** + * Inclusive. + * + * Generated from protobuf field optional int32 end = 2; + */ + private $end = 0; + private $has_end = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start + * Inclusive. + * @type int $end + * Inclusive. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @return int + */ + public function getStart() + { + return $this->start; + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 start = 1; + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + $this->has_start = true; + + return $this; + } + + public function hasStart() + { + return $this->has_start; + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @return int + */ + public function getEnd() + { + return $this->end; + } + + /** + * Inclusive. + * + * Generated from protobuf field optional int32 end = 2; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + + return $this; + } + + public function hasEnd() + { + return $this->has_end; + } + +} + +// 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/EnumDescriptorProto_EnumReservedRange.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php deleted file mode 100644 index 3d7b008e..00000000 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php +++ /dev/null @@ -1,121 +0,0 @@ -google.protobuf.EnumDescriptorProto.EnumReservedRange - */ -class EnumDescriptorProto_EnumReservedRange extends \Google\Protobuf\Internal\Message -{ - /** - * Inclusive. - * - * Generated from protobuf field optional int32 start = 1; - */ - private $start = 0; - private $has_start = false; - /** - * Inclusive. - * - * Generated from protobuf field optional int32 end = 2; - */ - private $end = 0; - private $has_end = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $start - * Inclusive. - * @type int $end - * Inclusive. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct($data); - } - - /** - * Inclusive. - * - * Generated from protobuf field optional int32 start = 1; - * @return int - */ - public function getStart() - { - return $this->start; - } - - /** - * Inclusive. - * - * Generated from protobuf field optional int32 start = 1; - * @param int $var - * @return $this - */ - public function setStart($var) - { - GPBUtil::checkInt32($var); - $this->start = $var; - $this->has_start = true; - - return $this; - } - - public function hasStart() - { - return $this->has_start; - } - - /** - * Inclusive. - * - * Generated from protobuf field optional int32 end = 2; - * @return int - */ - public function getEnd() - { - return $this->end; - } - - /** - * Inclusive. - * - * Generated from protobuf field optional int32 end = 2; - * @param int $var - * @return $this - */ - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - - return $this; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php new file mode 100644 index 00000000..b105088e --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php @@ -0,0 +1,30 @@ +google.protobuf.FieldDescriptorProto.Label + */ +class Label +{ + /** + * 0 is reserved for errors + * + * Generated from protobuf enum LABEL_OPTIONAL = 1; + */ + const LABEL_OPTIONAL = 1; + /** + * Generated from protobuf enum LABEL_REQUIRED = 2; + */ + const LABEL_REQUIRED = 2; + /** + * Generated from protobuf enum LABEL_REPEATED = 3; + */ + 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 new file mode 100644 index 00000000..ea228a77 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php @@ -0,0 +1,110 @@ +google.protobuf.FieldDescriptorProto.Type + */ +class Type +{ + /** + * 0 is reserved for errors. + * Order is weird for historical reasons. + * + * Generated from protobuf enum TYPE_DOUBLE = 1; + */ + const TYPE_DOUBLE = 1; + /** + * Generated from protobuf enum TYPE_FLOAT = 2; + */ + const TYPE_FLOAT = 2; + /** + * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + * + * Generated from protobuf enum TYPE_INT64 = 3; + */ + const TYPE_INT64 = 3; + /** + * Generated from protobuf enum TYPE_UINT64 = 4; + */ + const TYPE_UINT64 = 4; + /** + * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + * + * Generated from protobuf enum TYPE_INT32 = 5; + */ + const TYPE_INT32 = 5; + /** + * Generated from protobuf enum TYPE_FIXED64 = 6; + */ + const TYPE_FIXED64 = 6; + /** + * Generated from protobuf enum TYPE_FIXED32 = 7; + */ + const TYPE_FIXED32 = 7; + /** + * Generated from protobuf enum TYPE_BOOL = 8; + */ + const TYPE_BOOL = 8; + /** + * Generated from protobuf enum TYPE_STRING = 9; + */ + const TYPE_STRING = 9; + /** + * 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. + * + * Generated from protobuf enum TYPE_GROUP = 10; + */ + const TYPE_GROUP = 10; + /** + * Length-delimited aggregate. + * + * Generated from protobuf enum TYPE_MESSAGE = 11; + */ + const TYPE_MESSAGE = 11; + /** + * New in version 2. + * + * Generated from protobuf enum TYPE_BYTES = 12; + */ + const TYPE_BYTES = 12; + /** + * Generated from protobuf enum TYPE_UINT32 = 13; + */ + const TYPE_UINT32 = 13; + /** + * Generated from protobuf enum TYPE_ENUM = 14; + */ + const TYPE_ENUM = 14; + /** + * Generated from protobuf enum TYPE_SFIXED32 = 15; + */ + const TYPE_SFIXED32 = 15; + /** + * Generated from protobuf enum TYPE_SFIXED64 = 16; + */ + const TYPE_SFIXED64 = 16; + /** + * Uses ZigZag encoding. + * + * Generated from protobuf enum TYPE_SINT32 = 17; + */ + const TYPE_SINT32 = 17; + /** + * Uses ZigZag encoding. + * + * Generated from protobuf enum TYPE_SINT64 = 18; + */ + 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/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php deleted file mode 100644 index f2a32fdf..00000000 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php +++ /dev/null @@ -1,27 +0,0 @@ -Google\Protobuf\Internal - */ -class FieldDescriptorProto_Label -{ - /** - * 0 is reserved for errors - * - * Generated from protobuf enum LABEL_OPTIONAL = 1; - */ - const LABEL_OPTIONAL = 1; - /** - * Generated from protobuf enum LABEL_REQUIRED = 2; - */ - const LABEL_REQUIRED = 2; - /** - * Generated from protobuf enum LABEL_REPEATED = 3; - */ - const LABEL_REPEATED = 3; -} - diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php deleted file mode 100644 index 1b022deb..00000000 --- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php +++ /dev/null @@ -1,107 +0,0 @@ -Google\Protobuf\Internal - */ -class FieldDescriptorProto_Type -{ - /** - * 0 is reserved for errors. - * Order is weird for historical reasons. - * - * Generated from protobuf enum TYPE_DOUBLE = 1; - */ - const TYPE_DOUBLE = 1; - /** - * Generated from protobuf enum TYPE_FLOAT = 2; - */ - const TYPE_FLOAT = 2; - /** - * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - * negative values are likely. - * - * Generated from protobuf enum TYPE_INT64 = 3; - */ - const TYPE_INT64 = 3; - /** - * Generated from protobuf enum TYPE_UINT64 = 4; - */ - const TYPE_UINT64 = 4; - /** - * Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - * negative values are likely. - * - * Generated from protobuf enum TYPE_INT32 = 5; - */ - const TYPE_INT32 = 5; - /** - * Generated from protobuf enum TYPE_FIXED64 = 6; - */ - const TYPE_FIXED64 = 6; - /** - * Generated from protobuf enum TYPE_FIXED32 = 7; - */ - const TYPE_FIXED32 = 7; - /** - * Generated from protobuf enum TYPE_BOOL = 8; - */ - const TYPE_BOOL = 8; - /** - * Generated from protobuf enum TYPE_STRING = 9; - */ - const TYPE_STRING = 9; - /** - * 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. - * - * Generated from protobuf enum TYPE_GROUP = 10; - */ - const TYPE_GROUP = 10; - /** - * Length-delimited aggregate. - * - * Generated from protobuf enum TYPE_MESSAGE = 11; - */ - const TYPE_MESSAGE = 11; - /** - * New in version 2. - * - * Generated from protobuf enum TYPE_BYTES = 12; - */ - const TYPE_BYTES = 12; - /** - * Generated from protobuf enum TYPE_UINT32 = 13; - */ - const TYPE_UINT32 = 13; - /** - * Generated from protobuf enum TYPE_ENUM = 14; - */ - const TYPE_ENUM = 14; - /** - * Generated from protobuf enum TYPE_SFIXED32 = 15; - */ - const TYPE_SFIXED32 = 15; - /** - * Generated from protobuf enum TYPE_SFIXED64 = 16; - */ - const TYPE_SFIXED64 = 16; - /** - * Uses ZigZag encoding. - * - * Generated from protobuf enum TYPE_SINT32 = 17; - */ - const TYPE_SINT32 = 17; - /** - * Uses ZigZag encoding. - * - * Generated from protobuf enum TYPE_SINT64 = 18; - */ - const TYPE_SINT64 = 18; -} - diff --git a/php/src/Google/Protobuf/Internal/FieldOptions/CType.php b/php/src/Google/Protobuf/Internal/FieldOptions/CType.php new file mode 100644 index 00000000..016197ac --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldOptions/CType.php @@ -0,0 +1,30 @@ +google.protobuf.FieldOptions.CType + */ +class CType +{ + /** + * Default mode. + * + * Generated from protobuf enum STRING = 0; + */ + const STRING = 0; + /** + * Generated from protobuf enum CORD = 1; + */ + const CORD = 1; + /** + * Generated from protobuf enum STRING_PIECE = 2; + */ + 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 new file mode 100644 index 00000000..f7b78a1b --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php @@ -0,0 +1,34 @@ +google.protobuf.FieldOptions.JSType + */ +class JSType +{ + /** + * Use the default type. + * + * Generated from protobuf enum JS_NORMAL = 0; + */ + const JS_NORMAL = 0; + /** + * Use JavaScript strings. + * + * Generated from protobuf enum JS_STRING = 1; + */ + const JS_STRING = 1; + /** + * Use JavaScript numbers. + * + * Generated from protobuf enum JS_NUMBER = 2; + */ + 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/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php deleted file mode 100644 index 0f33072d..00000000 --- a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php +++ /dev/null @@ -1,27 +0,0 @@ -Google\Protobuf\Internal - */ -class FieldOptions_CType -{ - /** - * Default mode. - * - * Generated from protobuf enum STRING = 0; - */ - const STRING = 0; - /** - * Generated from protobuf enum CORD = 1; - */ - const CORD = 1; - /** - * Generated from protobuf enum STRING_PIECE = 2; - */ - const STRING_PIECE = 2; -} - diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php deleted file mode 100644 index 73bdf3f2..00000000 --- a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php +++ /dev/null @@ -1,31 +0,0 @@ -Google\Protobuf\Internal - */ -class FieldOptions_JSType -{ - /** - * Use the default type. - * - * Generated from protobuf enum JS_NORMAL = 0; - */ - const JS_NORMAL = 0; - /** - * Use JavaScript strings. - * - * Generated from protobuf enum JS_STRING = 1; - */ - const JS_STRING = 1; - /** - * Use JavaScript numbers. - * - * Generated from protobuf enum JS_NUMBER = 2; - */ - const JS_NUMBER = 2; -} - 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 new file mode 100644 index 00000000..3dd60bf6 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php @@ -0,0 +1,36 @@ +google.protobuf.FileOptions.OptimizeMode + */ +class OptimizeMode +{ + /** + * Generate complete code for parsing, serialization, + * + * Generated from protobuf enum SPEED = 1; + */ + const SPEED = 1; + /** + * etc. + * + * Generated from protobuf enum CODE_SIZE = 2; + */ + const CODE_SIZE = 2; + /** + * Generate code using MessageLite and the lite runtime. + * + * Generated from protobuf enum LITE_RUNTIME = 3; + */ + 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/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php deleted file mode 100644 index 4dd56ef8..00000000 --- a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php +++ /dev/null @@ -1,33 +0,0 @@ -Google\Protobuf\Internal - */ -class FileOptions_OptimizeMode -{ - /** - * Generate complete code for parsing, serialization, - * - * Generated from protobuf enum SPEED = 1; - */ - const SPEED = 1; - /** - * etc. - * - * Generated from protobuf enum CODE_SIZE = 2; - */ - const CODE_SIZE = 2; - /** - * Generate code using MessageLite and the lite runtime. - * - * Generated from protobuf enum LITE_RUNTIME = 3; - */ - const LITE_RUNTIME = 3; -} - 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 repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - * @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 new file mode 100644 index 00000000..09f958d2 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php @@ -0,0 +1,216 @@ +google.protobuf.GeneratedCodeInfo.Annotation + */ +class Annotation extends \Google\Protobuf\Internal\Message +{ + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + */ + private $path; + private $has_path = false; + /** + * Identifies the filesystem path to the original source .proto. + * + * Generated from protobuf field optional string source_file = 2; + */ + private $source_file = ''; + private $has_source_file = false; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * + * Generated from protobuf field optional int32 begin = 3; + */ + private $begin = 0; + private $has_begin = false; + /** + * 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). + * + * Generated from protobuf field optional int32 end = 4; + */ + private $end = 0; + private $has_end = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int[]|\Google\Protobuf\Internal\RepeatedField $path + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * @type string $source_file + * Identifies the filesystem path to the original source .proto. + * @type int $begin + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * @type int $end + * 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). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPath() + { + return $this->path; + } + + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPath($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $arr; + $this->has_path = true; + + return $this; + } + + public function hasPath() + { + return $this->has_path; + } + + /** + * Identifies the filesystem path to the original source .proto. + * + * Generated from protobuf field optional string source_file = 2; + * @return string + */ + public function getSourceFile() + { + return $this->source_file; + } + + /** + * Identifies the filesystem path to the original source .proto. + * + * Generated from protobuf field optional string source_file = 2; + * @param string $var + * @return $this + */ + public function setSourceFile($var) + { + GPBUtil::checkString($var, True); + $this->source_file = $var; + $this->has_source_file = true; + + return $this; + } + + public function hasSourceFile() + { + return $this->has_source_file; + } + + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * + * Generated from protobuf field optional int32 begin = 3; + * @return int + */ + public function getBegin() + { + return $this->begin; + } + + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + * + * Generated from protobuf field optional int32 begin = 3; + * @param int $var + * @return $this + */ + public function setBegin($var) + { + GPBUtil::checkInt32($var); + $this->begin = $var; + $this->has_begin = true; + + return $this; + } + + public function hasBegin() + { + return $this->has_begin; + } + + /** + * 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). + * + * Generated from protobuf field optional int32 end = 4; + * @return int + */ + public function getEnd() + { + return $this->end; + } + + /** + * 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). + * + * Generated from protobuf field optional int32 end = 4; + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + + return $this; + } + + public function hasEnd() + { + return $this->has_end; + } + +} + +// 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/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php deleted file mode 100644 index 75182007..00000000 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php +++ /dev/null @@ -1,213 +0,0 @@ -google.protobuf.GeneratedCodeInfo.Annotation - */ -class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message -{ - /** - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - * - * Generated from protobuf field repeated int32 path = 1 [packed = true]; - */ - private $path; - private $has_path = false; - /** - * Identifies the filesystem path to the original source .proto. - * - * Generated from protobuf field optional string source_file = 2; - */ - private $source_file = ''; - private $has_source_file = false; - /** - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - * - * Generated from protobuf field optional int32 begin = 3; - */ - private $begin = 0; - private $has_begin = false; - /** - * 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). - * - * Generated from protobuf field optional int32 end = 4; - */ - private $end = 0; - private $has_end = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int[]|\Google\Protobuf\Internal\RepeatedField $path - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - * @type string $source_file - * Identifies the filesystem path to the original source .proto. - * @type int $begin - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - * @type int $end - * 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). - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct($data); - } - - /** - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - * - * Generated from protobuf field repeated int32 path = 1 [packed = true]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getPath() - { - return $this->path; - } - - /** - * Identifies the element in the original source .proto file. This field - * is formatted the same as SourceCodeInfo.Location.path. - * - * Generated from protobuf field repeated int32 path = 1 [packed = true]; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setPath($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->path = $arr; - $this->has_path = true; - - return $this; - } - - public function hasPath() - { - return $this->has_path; - } - - /** - * Identifies the filesystem path to the original source .proto. - * - * Generated from protobuf field optional string source_file = 2; - * @return string - */ - public function getSourceFile() - { - return $this->source_file; - } - - /** - * Identifies the filesystem path to the original source .proto. - * - * Generated from protobuf field optional string source_file = 2; - * @param string $var - * @return $this - */ - public function setSourceFile($var) - { - GPBUtil::checkString($var, True); - $this->source_file = $var; - $this->has_source_file = true; - - return $this; - } - - public function hasSourceFile() - { - return $this->has_source_file; - } - - /** - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - * - * Generated from protobuf field optional int32 begin = 3; - * @return int - */ - public function getBegin() - { - return $this->begin; - } - - /** - * Identifies the starting offset in bytes in the generated code - * that relates to the identified object. - * - * Generated from protobuf field optional int32 begin = 3; - * @param int $var - * @return $this - */ - public function setBegin($var) - { - GPBUtil::checkInt32($var); - $this->begin = $var; - $this->has_begin = true; - - return $this; - } - - public function hasBegin() - { - return $this->has_begin; - } - - /** - * 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). - * - * Generated from protobuf field optional int32 end = 4; - * @return int - */ - public function getEnd() - { - return $this->end; - } - - /** - * 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). - * - * Generated from protobuf field optional int32 end = 4; - * @param int $var - * @return $this - */ - public function setEnd($var) - { - GPBUtil::checkInt32($var); - $this->end = $var; - $this->has_end = true; - - return $this; - } - - public function hasEnd() - { - return $this->has_end; - } - -} - diff --git a/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php new file mode 100644 index 00000000..dcc30e27 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php @@ -0,0 +1,36 @@ +google.protobuf.MethodOptions.IdempotencyLevel + */ +class IdempotencyLevel +{ + /** + * Generated from protobuf enum IDEMPOTENCY_UNKNOWN = 0; + */ + const IDEMPOTENCY_UNKNOWN = 0; + /** + * implies idempotent + * + * Generated from protobuf enum NO_SIDE_EFFECTS = 1; + */ + const NO_SIDE_EFFECTS = 1; + /** + * idempotent, but may have side effects + * + * Generated from protobuf enum IDEMPOTENT = 2; + */ + 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/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php deleted file mode 100644 index 9e06d8ee..00000000 --- a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php +++ /dev/null @@ -1,33 +0,0 @@ -Google\Protobuf\Internal - */ -class MethodOptions_IdempotencyLevel -{ - /** - * Generated from protobuf enum IDEMPOTENCY_UNKNOWN = 0; - */ - const IDEMPOTENCY_UNKNOWN = 0; - /** - * implies idempotent - * - * Generated from protobuf enum NO_SIDE_EFFECTS = 1; - */ - const NO_SIDE_EFFECTS = 1; - /** - * idempotent, but may have side effects - * - * Generated from protobuf enum IDEMPOTENT = 2; - */ - const IDEMPOTENT = 2; -} - 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 repeated .google.protobuf.SourceCodeInfo.Location location = 1; - * @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 new file mode 100644 index 00000000..bad247a1 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php @@ -0,0 +1,463 @@ +google.protobuf.SourceCodeInfo.Location + */ +class Location extends \Google\Protobuf\Internal\Message +{ + /** + * 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 + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + */ + private $path; + private $has_path = false; + /** + * 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. + * + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + */ + private $span; + private $has_span = false; + /** + * 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. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * + * Generated from protobuf field optional string leading_comments = 3; + */ + private $leading_comments = ''; + private $has_leading_comments = false; + /** + * Generated from protobuf field optional string trailing_comments = 4; + */ + private $trailing_comments = ''; + private $has_trailing_comments = false; + /** + * Generated from protobuf field repeated string leading_detached_comments = 6; + */ + private $leading_detached_comments; + private $has_leading_detached_comments = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int[]|\Google\Protobuf\Internal\RepeatedField $path + * 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 + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * @type int[]|\Google\Protobuf\Internal\RepeatedField $span + * 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. + * @type string $leading_comments + * 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. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * @type string $trailing_comments + * @type string[]|\Google\Protobuf\Internal\RepeatedField $leading_detached_comments + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * 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 + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPath() + { + return $this->path; + } + + /** + * 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 + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + * + * Generated from protobuf field repeated int32 path = 1 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPath($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->path = $arr; + $this->has_path = true; + + return $this; + } + + public function hasPath() + { + return $this->has_path; + } + + /** + * 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. + * + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpan() + { + return $this->span; + } + + /** + * 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. + * + * Generated from protobuf field repeated int32 span = 2 [packed = true]; + * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpan($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->span = $arr; + $this->has_span = true; + + return $this; + } + + public function hasSpan() + { + return $this->has_span; + } + + /** + * 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. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * + * Generated from protobuf field optional string leading_comments = 3; + * @return string + */ + public function getLeadingComments() + { + return $this->leading_comments; + } + + /** + * 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. + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * Examples: + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * // Detached comment for corge paragraph 2. + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. */ + * /* Block comment attached to + * * grault. */ + * optional int32 grault = 6; + * // ignored detached comments. + * + * Generated from protobuf field optional string leading_comments = 3; + * @param string $var + * @return $this + */ + public function setLeadingComments($var) + { + GPBUtil::checkString($var, True); + $this->leading_comments = $var; + $this->has_leading_comments = true; + + return $this; + } + + public function hasLeadingComments() + { + return $this->has_leading_comments; + } + + /** + * Generated from protobuf field optional string trailing_comments = 4; + * @return string + */ + public function getTrailingComments() + { + return $this->trailing_comments; + } + + /** + * Generated from protobuf field optional string trailing_comments = 4; + * @param string $var + * @return $this + */ + public function setTrailingComments($var) + { + GPBUtil::checkString($var, True); + $this->trailing_comments = $var; + $this->has_trailing_comments = true; + + return $this; + } + + public function hasTrailingComments() + { + return $this->has_trailing_comments; + } + + /** + * Generated from protobuf field repeated string leading_detached_comments = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getLeadingDetachedComments() + { + return $this->leading_detached_comments; + } + + /** + * Generated from protobuf field repeated string leading_detached_comments = 6; + * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setLeadingDetachedComments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->leading_detached_comments = $arr; + $this->has_leading_detached_comments = true; + + return $this; + } + + public function hasLeadingDetachedComments() + { + return $this->has_leading_detached_comments; + } + +} + +// 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/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php deleted file mode 100644 index f930aac1..00000000 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php +++ /dev/null @@ -1,460 +0,0 @@ -google.protobuf.SourceCodeInfo.Location - */ -class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message -{ - /** - * 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 - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - * - * Generated from protobuf field repeated int32 path = 1 [packed = true]; - */ - private $path; - private $has_path = false; - /** - * 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. - * - * Generated from protobuf field repeated int32 span = 2 [packed = true]; - */ - private $span; - private $has_span = false; - /** - * 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. - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * Examples: - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * // Detached comment for corge paragraph 2. - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ - * optional int32 grault = 6; - * // ignored detached comments. - * - * Generated from protobuf field optional string leading_comments = 3; - */ - private $leading_comments = ''; - private $has_leading_comments = false; - /** - * Generated from protobuf field optional string trailing_comments = 4; - */ - private $trailing_comments = ''; - private $has_trailing_comments = false; - /** - * Generated from protobuf field repeated string leading_detached_comments = 6; - */ - private $leading_detached_comments; - private $has_leading_detached_comments = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int[]|\Google\Protobuf\Internal\RepeatedField $path - * 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 - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - * @type int[]|\Google\Protobuf\Internal\RepeatedField $span - * 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. - * @type string $leading_comments - * 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. - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * Examples: - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * // Detached comment for corge paragraph 2. - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ - * optional int32 grault = 6; - * // ignored detached comments. - * @type string $trailing_comments - * @type string[]|\Google\Protobuf\Internal\RepeatedField $leading_detached_comments - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct($data); - } - - /** - * 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 - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - * - * Generated from protobuf field repeated int32 path = 1 [packed = true]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getPath() - { - return $this->path; - } - - /** - * 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 - * the root FileDescriptorProto to the place where the definition. For - * example, this path: - * [ 4, 3, 2, 7, 1 ] - * refers to: - * file.message_type(3) // 4, 3 - * .field(7) // 2, 7 - * .name() // 1 - * This is because FileDescriptorProto.message_type has field number 4: - * repeated DescriptorProto message_type = 4; - * and DescriptorProto.field has field number 2: - * repeated FieldDescriptorProto field = 2; - * and FieldDescriptorProto.name has field number 1: - * optional string name = 1; - * Thus, the above path gives the location of a field name. If we removed - * the last element: - * [ 4, 3, 2, 7 ] - * this path refers to the whole field declaration (from the beginning - * of the label to the terminating semicolon). - * - * Generated from protobuf field repeated int32 path = 1 [packed = true]; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setPath($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->path = $arr; - $this->has_path = true; - - return $this; - } - - public function hasPath() - { - return $this->has_path; - } - - /** - * 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. - * - * Generated from protobuf field repeated int32 span = 2 [packed = true]; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getSpan() - { - return $this->span; - } - - /** - * 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. - * - * Generated from protobuf field repeated int32 span = 2 [packed = true]; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setSpan($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); - $this->span = $arr; - $this->has_span = true; - - return $this; - } - - public function hasSpan() - { - return $this->has_span; - } - - /** - * 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. - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * Examples: - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * // Detached comment for corge paragraph 2. - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ - * optional int32 grault = 6; - * // ignored detached comments. - * - * Generated from protobuf field optional string leading_comments = 3; - * @return string - */ - public function getLeadingComments() - { - return $this->leading_comments; - } - - /** - * 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. - * A series of line comments appearing on consecutive lines, with no other - * tokens appearing on those lines, will be treated as a single comment. - * leading_detached_comments will keep paragraphs of comments that appear - * before (but not connected to) the current element. Each paragraph, - * separated by empty lines, will be one comment element in the repeated - * field. - * Only the comment content is provided; comment markers (e.g. //) are - * stripped out. For block comments, leading whitespace and an asterisk - * will be stripped from the beginning of each line other than the first. - * Newlines are included in the output. - * Examples: - * optional int32 foo = 1; // Comment attached to foo. - * // Comment attached to bar. - * optional int32 bar = 2; - * optional string baz = 3; - * // Comment attached to baz. - * // Another line attached to baz. - * // Comment attached to qux. - * // - * // Another line attached to qux. - * optional double qux = 4; - * // Detached comment for corge. This is not leading or trailing comments - * // to qux or corge because there are blank lines separating it from - * // both. - * // Detached comment for corge paragraph 2. - * optional string corge = 5; - * /* Block comment attached - * * to corge. Leading asterisks - * * will be removed. */ - * /* Block comment attached to - * * grault. */ - * optional int32 grault = 6; - * // ignored detached comments. - * - * Generated from protobuf field optional string leading_comments = 3; - * @param string $var - * @return $this - */ - public function setLeadingComments($var) - { - GPBUtil::checkString($var, True); - $this->leading_comments = $var; - $this->has_leading_comments = true; - - return $this; - } - - public function hasLeadingComments() - { - return $this->has_leading_comments; - } - - /** - * Generated from protobuf field optional string trailing_comments = 4; - * @return string - */ - public function getTrailingComments() - { - return $this->trailing_comments; - } - - /** - * Generated from protobuf field optional string trailing_comments = 4; - * @param string $var - * @return $this - */ - public function setTrailingComments($var) - { - GPBUtil::checkString($var, True); - $this->trailing_comments = $var; - $this->has_trailing_comments = true; - - return $this; - } - - public function hasTrailingComments() - { - return $this->has_trailing_comments; - } - - /** - * Generated from protobuf field repeated string leading_detached_comments = 6; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getLeadingDetachedComments() - { - return $this->leading_detached_comments; - } - - /** - * Generated from protobuf field repeated string leading_detached_comments = 6; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setLeadingDetachedComments($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->leading_detached_comments = $arr; - $this->has_leading_detached_comments = true; - - return $this; - } - - public function hasLeadingDetachedComments() - { - return $this->has_leading_detached_comments; - } - -} - 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 repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - * @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 new file mode 100644 index 00000000..92ee4b44 --- /dev/null +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php @@ -0,0 +1,110 @@ +google.protobuf.UninterpretedOption.NamePart + */ +class NamePart extends \Google\Protobuf\Internal\Message +{ + /** + * Generated from protobuf field required string name_part = 1; + */ + private $name_part = ''; + private $has_name_part = false; + /** + * Generated from protobuf field required bool is_extension = 2; + */ + private $is_extension = false; + private $has_is_extension = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name_part + * @type bool $is_extension + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct($data); + } + + /** + * Generated from protobuf field required string name_part = 1; + * @return string + */ + public function getNamePart() + { + return $this->name_part; + } + + /** + * Generated from protobuf field required string name_part = 1; + * @param string $var + * @return $this + */ + public function setNamePart($var) + { + GPBUtil::checkString($var, True); + $this->name_part = $var; + $this->has_name_part = true; + + return $this; + } + + public function hasNamePart() + { + return $this->has_name_part; + } + + /** + * Generated from protobuf field required bool is_extension = 2; + * @return bool + */ + public function getIsExtension() + { + return $this->is_extension; + } + + /** + * Generated from protobuf field required bool is_extension = 2; + * @param bool $var + * @return $this + */ + public function setIsExtension($var) + { + GPBUtil::checkBool($var); + $this->is_extension = $var; + $this->has_is_extension = true; + + return $this; + } + + public function hasIsExtension() + { + return $this->has_is_extension; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(NamePart::class, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class); + diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php deleted file mode 100644 index d4369fda..00000000 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php +++ /dev/null @@ -1,107 +0,0 @@ -google.protobuf.UninterpretedOption.NamePart - */ -class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message -{ - /** - * Generated from protobuf field required string name_part = 1; - */ - private $name_part = ''; - private $has_name_part = false; - /** - * Generated from protobuf field required bool is_extension = 2; - */ - private $is_extension = false; - private $has_is_extension = false; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name_part - * @type bool $is_extension - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct($data); - } - - /** - * Generated from protobuf field required string name_part = 1; - * @return string - */ - public function getNamePart() - { - return $this->name_part; - } - - /** - * Generated from protobuf field required string name_part = 1; - * @param string $var - * @return $this - */ - public function setNamePart($var) - { - GPBUtil::checkString($var, True); - $this->name_part = $var; - $this->has_name_part = true; - - return $this; - } - - public function hasNamePart() - { - return $this->has_name_part; - } - - /** - * Generated from protobuf field required bool is_extension = 2; - * @return bool - */ - public function getIsExtension() - { - return $this->is_extension; - } - - /** - * Generated from protobuf field required bool is_extension = 2; - * @param bool $var - * @return $this - */ - public function setIsExtension($var) - { - GPBUtil::checkBool($var); - $this->is_extension = $var; - $this->has_is_extension = true; - - return $this; - } - - public function hasIsExtension() - { - return $this->has_is_extension; - } - -} - -- cgit v1.2.3