aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src
diff options
context:
space:
mode:
authorGravatar Brent Shaffer <betterbrent@google.com>2018-05-23 16:43:30 -0700
committerGravatar Bo Yang <teboring@google.com>2018-05-25 13:04:19 -0700
commit2774e5441d8508b7d61cc3786b69149dc43d9f42 (patch)
tree5415e227b9f454a402caf23d71bafadef2627dc4 /php/src
parent8b336f8c5a77ca4932b00203e485f9266f6f0c30 (diff)
PHP namespaces for nested messages and enums (#4536)
* uses namespaces for nested messages and enums * fixes namespaces for PHP dist * fixes namespace for Descriptors, adds Cardinality and Kind * fixes nested namespaces for reserved words and adds tests * adds tests and generator fix for php class prefixes * fixes escaping of protobuf packages, enum comments, misc others * nice refactor of generated code * adds class files for backwards compatibility * simplifies code with templates * adds compatibility files to makefile * cleanup of generator and fixes nested namespace bug * regenerates proto types * remove internal BC classes * adds deprecated warning, adds methods back * simplifies if statement * fixes dist files * addresses review comments * adds back TYPE_URL_PREFIX constant * adds @deprecated to old nested class files * skips tests which require a separate process when protobuf.so is enabled * Adds tests for legacy nested classes that do not require separate processes to test * uses legacy names for GPBUtil message check * adds block for IDE @deprecated message * Namespace for nested message/enum in c extension * Remove unused code
Diffstat (limited to 'php/src')
-rw-r--r--php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php12
-rw-r--r--php/src/Google/Protobuf/Any.php108
-rw-r--r--php/src/Google/Protobuf/Api.php44
-rw-r--r--php/src/Google/Protobuf/BoolValue.php14
-rw-r--r--php/src/Google/Protobuf/BytesValue.php14
-rw-r--r--php/src/Google/Protobuf/DoubleValue.php14
-rw-r--r--php/src/Google/Protobuf/Duration.php24
-rw-r--r--php/src/Google/Protobuf/Enum.php22
-rw-r--r--php/src/Google/Protobuf/EnumValue.php18
-rw-r--r--php/src/Google/Protobuf/Field.php34
-rw-r--r--php/src/Google/Protobuf/Field/Cardinality.php42
-rw-r--r--php/src/Google/Protobuf/Field/Kind.php132
-rw-r--r--php/src/Google/Protobuf/FieldMask.php18
-rw-r--r--php/src/Google/Protobuf/Field_Cardinality.php35
-rw-r--r--php/src/Google/Protobuf/Field_Kind.php125
-rw-r--r--php/src/Google/Protobuf/FloatValue.php14
-rw-r--r--php/src/Google/Protobuf/GPBEmpty.php12
-rw-r--r--php/src/Google/Protobuf/Int32Value.php14
-rw-r--r--php/src/Google/Protobuf/Int64Value.php14
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorProto.php12
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php (renamed from php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php)7
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php (renamed from php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php)7
-rw-r--r--php/src/Google/Protobuf/Internal/EnumDescriptorProto.php6
-rw-r--r--php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php (renamed from php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php)7
-rw-r--r--php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php (renamed from php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php)9
-rw-r--r--php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php (renamed from php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php)9
-rw-r--r--php/src/Google/Protobuf/Internal/FieldOptions/CType.php (renamed from php/src/Google/Protobuf/Internal/FieldOptions_CType.php)9
-rw-r--r--php/src/Google/Protobuf/Internal/FieldOptions/JSType.php (renamed from php/src/Google/Protobuf/Internal/FieldOptions_JSType.php)9
-rw-r--r--php/src/Google/Protobuf/Internal/FileOptions.php8
-rw-r--r--php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php (renamed from php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php)9
-rw-r--r--php/src/Google/Protobuf/Internal/GPBUtil.php18
-rw-r--r--php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php6
-rw-r--r--php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php (renamed from php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php)7
-rw-r--r--php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php (renamed from php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php)9
-rw-r--r--php/src/Google/Protobuf/Internal/SourceCodeInfo.php6
-rw-r--r--php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php (renamed from php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php)7
-rw-r--r--php/src/Google/Protobuf/Internal/UninterpretedOption.php6
-rw-r--r--php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php (renamed from php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php)7
-rw-r--r--php/src/Google/Protobuf/ListValue.php14
-rw-r--r--php/src/Google/Protobuf/Method.php26
-rw-r--r--php/src/Google/Protobuf/Mixin.php17
-rw-r--r--php/src/Google/Protobuf/NullValue.php2
-rw-r--r--php/src/Google/Protobuf/Option.php22
-rw-r--r--php/src/Google/Protobuf/SourceContext.php15
-rw-r--r--php/src/Google/Protobuf/StringValue.php14
-rw-r--r--php/src/Google/Protobuf/Struct.php14
-rw-r--r--php/src/Google/Protobuf/Syntax.php2
-rw-r--r--php/src/Google/Protobuf/Timestamp.php23
-rw-r--r--php/src/Google/Protobuf/Type.php24
-rw-r--r--php/src/Google/Protobuf/UInt32Value.php14
-rw-r--r--php/src/Google/Protobuf/UInt64Value.php14
-rw-r--r--php/src/Google/Protobuf/Value.php24
52 files changed, 806 insertions, 287 deletions
diff --git a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
index 7057384b..e6362f2b 100644
--- a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
+++ b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
@@ -46,13 +46,13 @@ class Descriptor
->repeated('reserved_name', \Google\Protobuf\Internal\GPBType::STRING, 10)
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class)
+ $pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', \Google\Protobuf\Internal\DescriptorProto\ExtensionRange::class)
->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1)
->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2)
->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.ExtensionRangeOptions')
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class)
+ $pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', \Google\Protobuf\Internal\DescriptorProto\ReservedRange::class)
->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1)
->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2)
->finalizeToPool();
@@ -114,7 +114,7 @@ class Descriptor
->repeated('reserved_name', \Google\Protobuf\Internal\GPBType::STRING, 5)
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.EnumDescriptorProto.EnumReservedRange', \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class)
+ $pool->addMessage('google.protobuf.internal.EnumDescriptorProto.EnumReservedRange', \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange::class)
->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1)
->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2)
->finalizeToPool();
@@ -242,7 +242,7 @@ class Descriptor
->optional('aggregate_value', \Google\Protobuf\Internal\GPBType::STRING, 8)
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.UninterpretedOption.NamePart', \Google\Protobuf\Internal\UninterpretedOption_NamePart::class)
+ $pool->addMessage('google.protobuf.internal.UninterpretedOption.NamePart', \Google\Protobuf\Internal\UninterpretedOption\NamePart::class)
->required('name_part', \Google\Protobuf\Internal\GPBType::STRING, 1)
->required('is_extension', \Google\Protobuf\Internal\GPBType::BOOL, 2)
->finalizeToPool();
@@ -251,7 +251,7 @@ class Descriptor
->repeated('location', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.SourceCodeInfo.Location')
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.SourceCodeInfo.Location', \Google\Protobuf\Internal\SourceCodeInfo_Location::class)
+ $pool->addMessage('google.protobuf.internal.SourceCodeInfo.Location', \Google\Protobuf\Internal\SourceCodeInfo\Location::class)
->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1)
->repeated('span', \Google\Protobuf\Internal\GPBType::INT32, 2)
->optional('leading_comments', \Google\Protobuf\Internal\GPBType::STRING, 3)
@@ -263,7 +263,7 @@ class Descriptor
->repeated('annotation', \Google\Protobuf\Internal\GPBType::MESSAGE, 1, 'google.protobuf.internal.GeneratedCodeInfo.Annotation')
->finalizeToPool();
- $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo.Annotation', \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class)
+ $pool->addMessage('google.protobuf.internal.GeneratedCodeInfo.Annotation', \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class)
->repeated('path', \Google\Protobuf\Internal\GPBType::INT32, 1)
->optional('source_file', \Google\Protobuf\Internal\GPBType::STRING, 2)
->optional('begin', \Google\Protobuf\Internal\GPBType::INT32, 3)
diff --git a/php/src/Google/Protobuf/Any.php b/php/src/Google/Protobuf/Any.php
index f027b05d..a9928549 100644
--- a/php/src/Google/Protobuf/Any.php
+++ b/php/src/Google/Protobuf/Any.php
@@ -5,9 +5,9 @@
namespace Google\Protobuf;
use Google\Protobuf\Internal\GPBType;
-use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\Internal\Message;
use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\GPBUtil;
/**
* `Any` contains an arbitrary serialized protocol buffer message along with a
@@ -37,6 +37,14 @@ use Google\Protobuf\Internal\RepeatedField;
* if any.Is(Foo.DESCRIPTOR):
* any.Unpack(foo)
* ...
+ * Example 4: Pack and unpack a message in Go
+ * foo := &pb.Foo{...}
+ * any, err := ptypes.MarshalAny(foo)
+ * ...
+ * foo := &pb.Foo{}
+ * if err := ptypes.UnmarshalAny(any, foo); err != nil {
+ * ...
+ * }
* The pack methods provided by protobuf library will by default use
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
* methods only use the fully qualified type name after the last '/'
@@ -71,15 +79,16 @@ use Google\Protobuf\Internal\RepeatedField;
class Any extends \Google\Protobuf\Internal\Message
{
/**
- * A URL/resource name whose content describes the type of the
- * serialized protocol buffer message.
- * For URLs which use the scheme `http`, `https`, or no scheme, the
- * following restrictions and interpretations apply:
+ * A URL/resource name that uniquely identifies the type of the serialized
+ * protocol buffer message. The last segment of the URL's path must represent
+ * the fully qualified name of the type (as in
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
+ * (e.g., leading "." is not accepted).
+ * In practice, teams usually precompile into the binary all types that they
+ * expect it to use in the context of Any. However, for URLs which use the
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
+ * server that maps type URLs to message definitions as follows:
* * If no scheme is provided, `https` is assumed.
- * * The last segment of the URL's path must represent the fully
- * qualified name of the type (as in `path/google.protobuf.Duration`).
- * The name should be in a canonical form (e.g., leading "." is
- * not accepted).
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
@@ -87,6 +96,9 @@ class Any extends \Google\Protobuf\Internal\Message
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
+ * Note: this functionality is not currently available in the official
+ * protobuf release, and it is not used for type URLs beginning with
+ * type.googleapis.com.
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
@@ -102,21 +114,55 @@ class Any extends \Google\Protobuf\Internal\Message
const TYPE_URL_PREFIX = 'type.googleapis.com/';
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $type_url
+ * A URL/resource name that uniquely identifies the type of the serialized
+ * protocol buffer message. The last segment of the URL's path must represent
+ * the fully qualified name of the type (as in
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
+ * (e.g., leading "." is not accepted).
+ * In practice, teams usually precompile into the binary all types that they
+ * expect it to use in the context of Any. However, for URLs which use the
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
+ * server that maps type URLs to message definitions as follows:
+ * * If no scheme is provided, `https` is assumed.
+ * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
+ * value in binary format, or produce an error.
+ * * Applications are allowed to cache lookup results based on the
+ * URL, or have them precompiled into a binary to avoid any
+ * lookup. Therefore, binary compatibility needs to be preserved
+ * on changes to types. (Use versioned type names to manage
+ * breaking changes.)
+ * Note: this functionality is not currently available in the official
+ * protobuf release, and it is not used for type URLs beginning with
+ * type.googleapis.com.
+ * Schemes other than `http`, `https` (or the empty scheme) might be
+ * used with implementation specific semantics.
+ * @type string $value
+ * Must be a valid serialized protocol buffer of the above specified type.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Any::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
- * A URL/resource name whose content describes the type of the
- * serialized protocol buffer message.
- * For URLs which use the scheme `http`, `https`, or no scheme, the
- * following restrictions and interpretations apply:
+ * A URL/resource name that uniquely identifies the type of the serialized
+ * protocol buffer message. The last segment of the URL's path must represent
+ * the fully qualified name of the type (as in
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
+ * (e.g., leading "." is not accepted).
+ * In practice, teams usually precompile into the binary all types that they
+ * expect it to use in the context of Any. However, for URLs which use the
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
+ * server that maps type URLs to message definitions as follows:
* * If no scheme is provided, `https` is assumed.
- * * The last segment of the URL's path must represent the fully
- * qualified name of the type (as in `path/google.protobuf.Duration`).
- * The name should be in a canonical form (e.g., leading "." is
- * not accepted).
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
@@ -124,6 +170,9 @@ class Any extends \Google\Protobuf\Internal\Message
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
+ * Note: this functionality is not currently available in the official
+ * protobuf release, and it is not used for type URLs beginning with
+ * type.googleapis.com.
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
@@ -136,15 +185,16 @@ class Any extends \Google\Protobuf\Internal\Message
}
/**
- * A URL/resource name whose content describes the type of the
- * serialized protocol buffer message.
- * For URLs which use the scheme `http`, `https`, or no scheme, the
- * following restrictions and interpretations apply:
+ * A URL/resource name that uniquely identifies the type of the serialized
+ * protocol buffer message. The last segment of the URL's path must represent
+ * the fully qualified name of the type (as in
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
+ * (e.g., leading "." is not accepted).
+ * In practice, teams usually precompile into the binary all types that they
+ * expect it to use in the context of Any. However, for URLs which use the
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
+ * server that maps type URLs to message definitions as follows:
* * If no scheme is provided, `https` is assumed.
- * * The last segment of the URL's path must represent the fully
- * qualified name of the type (as in `path/google.protobuf.Duration`).
- * The name should be in a canonical form (e.g., leading "." is
- * not accepted).
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
@@ -152,6 +202,9 @@ class Any extends \Google\Protobuf\Internal\Message
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
+ * Note: this functionality is not currently available in the official
+ * protobuf release, and it is not used for type URLs beginning with
+ * type.googleapis.com.
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*
@@ -269,3 +322,4 @@ class Any extends \Google\Protobuf\Internal\Message
return $this->type_url === $type_url;
}
}
+
diff --git a/php/src/Google/Protobuf/Api.php b/php/src/Google/Protobuf/Api.php
index d0dda3cd..db37ffb0 100644
--- a/php/src/Google/Protobuf/Api.php
+++ b/php/src/Google/Protobuf/Api.php
@@ -83,9 +83,49 @@ class Api extends \Google\Protobuf\Internal\Message
*/
private $syntax = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The fully qualified name of this interface, including package name
+ * followed by the interface's simple name.
+ * @type \Google\Protobuf\Method[]|\Google\Protobuf\Internal\RepeatedField $methods
+ * The methods of this interface, in unspecified order.
+ * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
+ * Any metadata attached to the interface.
+ * @type string $version
+ * A version string for this interface. If specified, must have the form
+ * `major-version.minor-version`, as in `1.10`. If the minor version is
+ * omitted, it defaults to zero. If the entire version field is empty, the
+ * major version is derived from the package name, as outlined below. If the
+ * field is not empty, the version in the package name will be verified to be
+ * consistent with what is provided here.
+ * The versioning schema uses [semantic
+ * versioning](http://semver.org) where the major version number
+ * indicates a breaking change and the minor version an additive,
+ * non-breaking change. Both version numbers are signals to users
+ * what to expect from different versions, and should be carefully
+ * chosen based on the product plan.
+ * The major version is also reflected in the package name of the
+ * interface, which must end in `v<major-version>`, as in
+ * `google.feature.v1`. For major versions 0 and 1, the suffix can
+ * be omitted. Zero major versions must only be used for
+ * experimental, non-GA interfaces.
+ * @type \Google\Protobuf\SourceContext $source_context
+ * Source context for the protocol buffer service represented by this
+ * message.
+ * @type \Google\Protobuf\Mixin[]|\Google\Protobuf\Internal\RepeatedField $mixins
+ * Included interfaces. See [Mixin][].
+ * @type int $syntax
+ * The source syntax of the service.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Api::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/BoolValue.php b/php/src/Google/Protobuf/BoolValue.php
index c28bf941..13872eb1 100644
--- a/php/src/Google/Protobuf/BoolValue.php
+++ b/php/src/Google/Protobuf/BoolValue.php
@@ -23,9 +23,19 @@ class BoolValue extends \Google\Protobuf\Internal\Message
*/
private $value = false;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type bool $value
+ * The bool value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/BytesValue.php b/php/src/Google/Protobuf/BytesValue.php
index d6a6b2e6..f1b38171 100644
--- a/php/src/Google/Protobuf/BytesValue.php
+++ b/php/src/Google/Protobuf/BytesValue.php
@@ -23,9 +23,19 @@ class BytesValue extends \Google\Protobuf\Internal\Message
*/
private $value = '';
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $value
+ * The bytes value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/DoubleValue.php b/php/src/Google/Protobuf/DoubleValue.php
index 6718ce3c..236d9182 100644
--- a/php/src/Google/Protobuf/DoubleValue.php
+++ b/php/src/Google/Protobuf/DoubleValue.php
@@ -23,9 +23,19 @@ class DoubleValue extends \Google\Protobuf\Internal\Message
*/
private $value = 0.0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type float $value
+ * The double value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Duration.php b/php/src/Google/Protobuf/Duration.php
index ca1c4c07..414a1868 100644
--- a/php/src/Google/Protobuf/Duration.php
+++ b/php/src/Google/Protobuf/Duration.php
@@ -79,9 +79,28 @@ class Duration extends \Google\Protobuf\Internal\Message
*/
private $nanos = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int|string $seconds
+ * Signed seconds of the span of time. Must be from -315,576,000,000
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
+ * @type int $nanos
+ * Signed fractions of a second at nanosecond resolution of the span
+ * of time. Durations less than one second are represented with a 0
+ * `seconds` field and a positive or negative `nanos` field. For durations
+ * of one second or more, a non-zero value for the `nanos` field must be
+ * of the same sign as the `seconds` field. Must be from -999,999,999
+ * to +999,999,999 inclusive.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Duration::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
@@ -149,5 +168,6 @@ class Duration extends \Google\Protobuf\Internal\Message
return $this;
}
+
}
diff --git a/php/src/Google/Protobuf/Enum.php b/php/src/Google/Protobuf/Enum.php
index c63efc74..243c40d2 100644
--- a/php/src/Google/Protobuf/Enum.php
+++ b/php/src/Google/Protobuf/Enum.php
@@ -46,9 +46,27 @@ class Enum extends \Google\Protobuf\Internal\Message
*/
private $syntax = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Enum type name.
+ * @type \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $enumvalue
+ * Enum value definitions.
+ * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
+ * Protocol buffer options.
+ * @type \Google\Protobuf\SourceContext $source_context
+ * The source context.
+ * @type int $syntax
+ * The source syntax.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/EnumValue.php b/php/src/Google/Protobuf/EnumValue.php
index e102c29f..1dc3c7a6 100644
--- a/php/src/Google/Protobuf/EnumValue.php
+++ b/php/src/Google/Protobuf/EnumValue.php
@@ -34,9 +34,23 @@ class EnumValue extends \Google\Protobuf\Internal\Message
*/
private $options;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * Enum value name.
+ * @type int $number
+ * Enum value number.
+ * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
+ * Protocol buffer options.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Field.php b/php/src/Google/Protobuf/Field.php
index 0b560d89..8da43e34 100644
--- a/php/src/Google/Protobuf/Field.php
+++ b/php/src/Google/Protobuf/Field.php
@@ -78,9 +78,39 @@ class Field extends \Google\Protobuf\Internal\Message
*/
private $default_value = '';
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $kind
+ * The field type.
+ * @type int $cardinality
+ * The field cardinality.
+ * @type int $number
+ * The field number.
+ * @type string $name
+ * The field name.
+ * @type string $type_url
+ * The field type URL, without the scheme, for message or enumeration
+ * types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
+ * @type int $oneof_index
+ * The index of the field type in `Type.oneofs`, for message or enumeration
+ * types. The first type has index 1; zero means the type is not in the list.
+ * @type bool $packed
+ * Whether to use alternative packed wire representation.
+ * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
+ * The protocol buffer options.
+ * @type string $json_name
+ * The field JSON name.
+ * @type string $default_value
+ * The string value of the default value of this field. Proto2 syntax only.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Field/Cardinality.php b/php/src/Google/Protobuf/Field/Cardinality.php
new file mode 100644
index 00000000..c887f6d3
--- /dev/null
+++ b/php/src/Google/Protobuf/Field/Cardinality.php
@@ -0,0 +1,42 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/type.proto
+
+namespace Google\Protobuf\Field;
+
+/**
+ * Whether a field is optional, required, or repeated.
+ *
+ * Protobuf type <code>google.protobuf.Field.Cardinality</code>
+ */
+class Cardinality
+{
+ /**
+ * For fields with unknown cardinality.
+ *
+ * Generated from protobuf enum <code>CARDINALITY_UNKNOWN = 0;</code>
+ */
+ const CARDINALITY_UNKNOWN = 0;
+ /**
+ * For optional fields.
+ *
+ * Generated from protobuf enum <code>CARDINALITY_OPTIONAL = 1;</code>
+ */
+ const CARDINALITY_OPTIONAL = 1;
+ /**
+ * For required fields. Proto2 syntax only.
+ *
+ * Generated from protobuf enum <code>CARDINALITY_REQUIRED = 2;</code>
+ */
+ const CARDINALITY_REQUIRED = 2;
+ /**
+ * For repeated fields.
+ *
+ * Generated from protobuf enum <code>CARDINALITY_REPEATED = 3;</code>
+ */
+ const CARDINALITY_REPEATED = 3;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Cardinality::class, \Google\Protobuf\Field_Cardinality::class);
+
diff --git a/php/src/Google/Protobuf/Field/Kind.php b/php/src/Google/Protobuf/Field/Kind.php
new file mode 100644
index 00000000..a2bbbdeb
--- /dev/null
+++ b/php/src/Google/Protobuf/Field/Kind.php
@@ -0,0 +1,132 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/type.proto
+
+namespace Google\Protobuf\Field;
+
+/**
+ * Basic field types.
+ *
+ * Protobuf type <code>google.protobuf.Field.Kind</code>
+ */
+class Kind
+{
+ /**
+ * Field type unknown.
+ *
+ * Generated from protobuf enum <code>TYPE_UNKNOWN = 0;</code>
+ */
+ const TYPE_UNKNOWN = 0;
+ /**
+ * Field type double.
+ *
+ * Generated from protobuf enum <code>TYPE_DOUBLE = 1;</code>
+ */
+ const TYPE_DOUBLE = 1;
+ /**
+ * Field type float.
+ *
+ * Generated from protobuf enum <code>TYPE_FLOAT = 2;</code>
+ */
+ const TYPE_FLOAT = 2;
+ /**
+ * Field type int64.
+ *
+ * Generated from protobuf enum <code>TYPE_INT64 = 3;</code>
+ */
+ const TYPE_INT64 = 3;
+ /**
+ * Field type uint64.
+ *
+ * Generated from protobuf enum <code>TYPE_UINT64 = 4;</code>
+ */
+ const TYPE_UINT64 = 4;
+ /**
+ * Field type int32.
+ *
+ * Generated from protobuf enum <code>TYPE_INT32 = 5;</code>
+ */
+ const TYPE_INT32 = 5;
+ /**
+ * Field type fixed64.
+ *
+ * Generated from protobuf enum <code>TYPE_FIXED64 = 6;</code>
+ */
+ const TYPE_FIXED64 = 6;
+ /**
+ * Field type fixed32.
+ *
+ * Generated from protobuf enum <code>TYPE_FIXED32 = 7;</code>
+ */
+ const TYPE_FIXED32 = 7;
+ /**
+ * Field type bool.
+ *
+ * Generated from protobuf enum <code>TYPE_BOOL = 8;</code>
+ */
+ const TYPE_BOOL = 8;
+ /**
+ * Field type string.
+ *
+ * Generated from protobuf enum <code>TYPE_STRING = 9;</code>
+ */
+ const TYPE_STRING = 9;
+ /**
+ * Field type group. Proto2 syntax only, and deprecated.
+ *
+ * Generated from protobuf enum <code>TYPE_GROUP = 10;</code>
+ */
+ const TYPE_GROUP = 10;
+ /**
+ * Field type message.
+ *
+ * Generated from protobuf enum <code>TYPE_MESSAGE = 11;</code>
+ */
+ const TYPE_MESSAGE = 11;
+ /**
+ * Field type bytes.
+ *
+ * Generated from protobuf enum <code>TYPE_BYTES = 12;</code>
+ */
+ const TYPE_BYTES = 12;
+ /**
+ * Field type uint32.
+ *
+ * Generated from protobuf enum <code>TYPE_UINT32 = 13;</code>
+ */
+ const TYPE_UINT32 = 13;
+ /**
+ * Field type enum.
+ *
+ * Generated from protobuf enum <code>TYPE_ENUM = 14;</code>
+ */
+ const TYPE_ENUM = 14;
+ /**
+ * Field type sfixed32.
+ *
+ * Generated from protobuf enum <code>TYPE_SFIXED32 = 15;</code>
+ */
+ const TYPE_SFIXED32 = 15;
+ /**
+ * Field type sfixed64.
+ *
+ * Generated from protobuf enum <code>TYPE_SFIXED64 = 16;</code>
+ */
+ const TYPE_SFIXED64 = 16;
+ /**
+ * Field type sint32.
+ *
+ * Generated from protobuf enum <code>TYPE_SINT32 = 17;</code>
+ */
+ const TYPE_SINT32 = 17;
+ /**
+ * Field type sint64.
+ *
+ * Generated from protobuf enum <code>TYPE_SINT64 = 18;</code>
+ */
+ const TYPE_SINT64 = 18;
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Kind::class, \Google\Protobuf\Field_Kind::class);
+
diff --git a/php/src/Google/Protobuf/FieldMask.php b/php/src/Google/Protobuf/FieldMask.php
index e18586af..8fb38cbf 100644
--- a/php/src/Google/Protobuf/FieldMask.php
+++ b/php/src/Google/Protobuf/FieldMask.php
@@ -162,6 +162,10 @@ use Google\Protobuf\Internal\GPBUtil;
* }
* Note that oneof type names ("test_oneof" in this case) cannot be used in
* paths.
+ * ## Field Mask Verification
+ * The implementation of any API method which has a FieldMask type field in the
+ * request should verify the included field paths, and return an
+ * `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
*
* Generated from protobuf message <code>google.protobuf.FieldMask</code>
*/
@@ -174,9 +178,19 @@ class FieldMask extends \Google\Protobuf\Internal\Message
*/
private $paths;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string[]|\Google\Protobuf\Internal\RepeatedField $paths
+ * The set of field mask paths.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\FieldMask::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Field_Cardinality.php b/php/src/Google/Protobuf/Field_Cardinality.php
index 422587ca..dff8f893 100644
--- a/php/src/Google/Protobuf/Field_Cardinality.php
+++ b/php/src/Google/Protobuf/Field_Cardinality.php
@@ -4,36 +4,13 @@
namespace Google\Protobuf;
-/**
- * Whether a field is optional, required, or repeated.
- *
- * Protobuf enum <code>Google\Protobuf\Field\Cardinality</code>
- */
-class Field_Cardinality
-{
+if (false) {
/**
- * For fields with unknown cardinality.
- *
- * Generated from protobuf enum <code>CARDINALITY_UNKNOWN = 0;</code>
+ * This class is deprecated. Use Google\Protobuf\Field\Cardinality instead.
+ * @deprecated
*/
- const CARDINALITY_UNKNOWN = 0;
- /**
- * For optional fields.
- *
- * Generated from protobuf enum <code>CARDINALITY_OPTIONAL = 1;</code>
- */
- const CARDINALITY_OPTIONAL = 1;
- /**
- * For required fields. Proto2 syntax only.
- *
- * Generated from protobuf enum <code>CARDINALITY_REQUIRED = 2;</code>
- */
- const CARDINALITY_REQUIRED = 2;
- /**
- * For repeated fields.
- *
- * Generated from protobuf enum <code>CARDINALITY_REPEATED = 3;</code>
- */
- const CARDINALITY_REPEATED = 3;
+ class Field_Cardinality {}
}
+class_exists(Field\Cardinality::class);
+@trigger_error('Google\Protobuf\Field_Cardinality is deprecated and will be removed in the next major release. Use Google\Protobuf\Field\Cardinality instead', E_USER_DEPRECATED);
diff --git a/php/src/Google/Protobuf/Field_Kind.php b/php/src/Google/Protobuf/Field_Kind.php
index d0774970..aa202370 100644
--- a/php/src/Google/Protobuf/Field_Kind.php
+++ b/php/src/Google/Protobuf/Field_Kind.php
@@ -4,126 +4,13 @@
namespace Google\Protobuf;
-/**
- * Basic field types.
- *
- * Protobuf enum <code>Google\Protobuf\Field\Kind</code>
- */
-class Field_Kind
-{
+if (false) {
/**
- * Field type unknown.
- *
- * Generated from protobuf enum <code>TYPE_UNKNOWN = 0;</code>
+ * This class is deprecated. Use Google\Protobuf\Field\Kind instead.
+ * @deprecated
*/
- const TYPE_UNKNOWN = 0;
- /**
- * Field type double.
- *
- * Generated from protobuf enum <code>TYPE_DOUBLE = 1;</code>
- */
- const TYPE_DOUBLE = 1;
- /**
- * Field type float.
- *
- * Generated from protobuf enum <code>TYPE_FLOAT = 2;</code>
- */
- const TYPE_FLOAT = 2;
- /**
- * Field type int64.
- *
- * Generated from protobuf enum <code>TYPE_INT64 = 3;</code>
- */
- const TYPE_INT64 = 3;
- /**
- * Field type uint64.
- *
- * Generated from protobuf enum <code>TYPE_UINT64 = 4;</code>
- */
- const TYPE_UINT64 = 4;
- /**
- * Field type int32.
- *
- * Generated from protobuf enum <code>TYPE_INT32 = 5;</code>
- */
- const TYPE_INT32 = 5;
- /**
- * Field type fixed64.
- *
- * Generated from protobuf enum <code>TYPE_FIXED64 = 6;</code>
- */
- const TYPE_FIXED64 = 6;
- /**
- * Field type fixed32.
- *
- * Generated from protobuf enum <code>TYPE_FIXED32 = 7;</code>
- */
- const TYPE_FIXED32 = 7;
- /**
- * Field type bool.
- *
- * Generated from protobuf enum <code>TYPE_BOOL = 8;</code>
- */
- const TYPE_BOOL = 8;
- /**
- * Field type string.
- *
- * Generated from protobuf enum <code>TYPE_STRING = 9;</code>
- */
- const TYPE_STRING = 9;
- /**
- * Field type group. Proto2 syntax only, and deprecated.
- *
- * Generated from protobuf enum <code>TYPE_GROUP = 10;</code>
- */
- const TYPE_GROUP = 10;
- /**
- * Field type message.
- *
- * Generated from protobuf enum <code>TYPE_MESSAGE = 11;</code>
- */
- const TYPE_MESSAGE = 11;
- /**
- * Field type bytes.
- *
- * Generated from protobuf enum <code>TYPE_BYTES = 12;</code>
- */
- const TYPE_BYTES = 12;
- /**
- * Field type uint32.
- *
- * Generated from protobuf enum <code>TYPE_UINT32 = 13;</code>
- */
- const TYPE_UINT32 = 13;
- /**
- * Field type enum.
- *
- * Generated from protobuf enum <code>TYPE_ENUM = 14;</code>
- */
- const TYPE_ENUM = 14;
- /**
- * Field type sfixed32.
- *
- * Generated from protobuf enum <code>TYPE_SFIXED32 = 15;</code>
- */
- const TYPE_SFIXED32 = 15;
- /**
- * Field type sfixed64.
- *
- * Generated from protobuf enum <code>TYPE_SFIXED64 = 16;</code>
- */
- const TYPE_SFIXED64 = 16;
- /**
- * Field type sint32.
- *
- * Generated from protobuf enum <code>TYPE_SINT32 = 17;</code>
- */
- const TYPE_SINT32 = 17;
- /**
- * Field type sint64.
- *
- * Generated from protobuf enum <code>TYPE_SINT64 = 18;</code>
- */
- const TYPE_SINT64 = 18;
+ class Field_Kind {}
}
+class_exists(Field\Kind::class);
+@trigger_error('Google\Protobuf\Field_Kind is deprecated and will be removed in the next major release. Use Google\Protobuf\Field\Kind instead', E_USER_DEPRECATED);
diff --git a/php/src/Google/Protobuf/FloatValue.php b/php/src/Google/Protobuf/FloatValue.php
index 68787ef9..47ba52e6 100644
--- a/php/src/Google/Protobuf/FloatValue.php
+++ b/php/src/Google/Protobuf/FloatValue.php
@@ -23,9 +23,19 @@ class FloatValue extends \Google\Protobuf\Internal\Message
*/
private $value = 0.0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type float $value
+ * The float value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/GPBEmpty.php b/php/src/Google/Protobuf/GPBEmpty.php
index 24a93f96..2de9c3bc 100644
--- a/php/src/Google/Protobuf/GPBEmpty.php
+++ b/php/src/Google/Protobuf/GPBEmpty.php
@@ -22,9 +22,17 @@ use Google\Protobuf\Internal\GPBUtil;
class GPBEmpty extends \Google\Protobuf\Internal\Message
{
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\GPBEmpty::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
}
diff --git a/php/src/Google/Protobuf/Int32Value.php b/php/src/Google/Protobuf/Int32Value.php
index d48aff1b..d7fd528d 100644
--- a/php/src/Google/Protobuf/Int32Value.php
+++ b/php/src/Google/Protobuf/Int32Value.php
@@ -23,9 +23,19 @@ class Int32Value extends \Google\Protobuf\Internal\Message
*/
private $value = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $value
+ * The int32 value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Int64Value.php b/php/src/Google/Protobuf/Int64Value.php
index a6fb9c5d..ca663055 100644
--- a/php/src/Google/Protobuf/Int64Value.php
+++ b/php/src/Google/Protobuf/Int64Value.php
@@ -23,9 +23,19 @@ class Int64Value extends \Google\Protobuf\Internal\Message
*/
private $value = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int|string $value
+ * The int64 value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php
index 4676269e..3b215d52 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php
@@ -82,10 +82,10 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
* @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension
* @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $nested_type
* @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type
- * @type \Google\Protobuf\Internal\DescriptorProto_ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $extension_range
+ * @type \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $extension_range
* @type \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $oneof_decl
* @type \Google\Protobuf\Internal\MessageOptions $options
- * @type \Google\Protobuf\Internal\DescriptorProto_ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
+ * @type \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
* @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name
* Reserved field names, which may not be used by fields in the same message.
* A given name may only be reserved once.
@@ -247,12 +247,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
- * @param \Google\Protobuf\Internal\DescriptorProto_ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setExtensionRange($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ExtensionRange::class);
$this->extension_range = $arr;
$this->has_extension_range = true;
@@ -331,12 +331,12 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
- * @param \Google\Protobuf\Internal\DescriptorProto_ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReservedRange($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto\ReservedRange::class);
$this->reserved_range = $arr;
$this->has_reserved_range = true;
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php
index d926ee6e..c06a0a6e 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\DescriptorProto;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>google.protobuf.DescriptorProto.ExtensionRange</code>
*/
-class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
+class ExtensionRange extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>optional int32 start = 1;</code>
@@ -133,3 +133,6 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(ExtensionRange::class, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class);
+
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php
index 302eaaa9..73c964fa 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto/ReservedRange.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\DescriptorProto;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -17,7 +17,7 @@ use Google\Protobuf\Internal\GPBUtil;
*
* Generated from protobuf message <code>google.protobuf.DescriptorProto.ReservedRange</code>
*/
-class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
+class ReservedRange extends \Google\Protobuf\Internal\Message
{
/**
* Inclusive.
@@ -117,3 +117,6 @@ class DescriptorProto_ReservedRange extends \Google\Protobuf\Internal\Message
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(ReservedRange::class, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class);
+
diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
index 406bb5b5..da30fa99 100644
--- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
@@ -59,7 +59,7 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
* @type string $name
* @type \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $value
* @type \Google\Protobuf\Internal\EnumOptions $options
- * @type \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
+ * @type \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
* Range of reserved numeric values. Reserved numeric values may not be used
* by enum values in the same enum declaration. Reserved ranges may not
* overlap.
@@ -176,12 +176,12 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
* overlap.
*
* Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;</code>
- * @param \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReservedRange($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange::class);
$this->reserved_range = $arr;
$this->has_reserved_range = true;
diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php
index 3d7b008e..e1079585 100644
--- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php
+++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto/EnumReservedRange.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\EnumDescriptorProto;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -19,7 +19,7 @@ use Google\Protobuf\Internal\GPBUtil;
*
* Generated from protobuf message <code>google.protobuf.EnumDescriptorProto.EnumReservedRange</code>
*/
-class EnumDescriptorProto_EnumReservedRange extends \Google\Protobuf\Internal\Message
+class EnumReservedRange extends \Google\Protobuf\Internal\Message
{
/**
* Inclusive.
@@ -119,3 +119,6 @@ class EnumDescriptorProto_EnumReservedRange extends \Google\Protobuf\Internal\Me
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(EnumReservedRange::class, \Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange::class);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php
index f2a32fdf..b105088e 100644
--- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Label.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\FieldDescriptorProto;
/**
- * Protobuf enum <code>Google\Protobuf\Internal</code>
+ * Protobuf type <code>google.protobuf.FieldDescriptorProto.Label</code>
*/
-class FieldDescriptorProto_Label
+class Label
{
/**
* 0 is reserved for errors
@@ -25,3 +25,6 @@ class FieldDescriptorProto_Label
const LABEL_REPEATED = 3;
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Label::class, \Google\Protobuf\Internal\FieldDescriptorProto_Label::class);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php
index 1b022deb..ea228a77 100644
--- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto/Type.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\FieldDescriptorProto;
/**
- * Protobuf enum <code>Google\Protobuf\Internal</code>
+ * Protobuf type <code>google.protobuf.FieldDescriptorProto.Type</code>
*/
-class FieldDescriptorProto_Type
+class Type
{
/**
* 0 is reserved for errors.
@@ -105,3 +105,6 @@ class FieldDescriptorProto_Type
const TYPE_SINT64 = 18;
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Type::class, \Google\Protobuf\Internal\FieldDescriptorProto_Type::class);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions/CType.php
index 0f33072d..016197ac 100644
--- a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
+++ b/php/src/Google/Protobuf/Internal/FieldOptions/CType.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\FieldOptions;
/**
- * Protobuf enum <code>Google\Protobuf\Internal</code>
+ * Protobuf type <code>google.protobuf.FieldOptions.CType</code>
*/
-class FieldOptions_CType
+class CType
{
/**
* Default mode.
@@ -25,3 +25,6 @@ class FieldOptions_CType
const STRING_PIECE = 2;
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(CType::class, \Google\Protobuf\Internal\FieldOptions_CType::class);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php
index 73bdf3f2..f7b78a1b 100644
--- a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
+++ b/php/src/Google/Protobuf/Internal/FieldOptions/JSType.php
@@ -2,12 +2,12 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\FieldOptions;
/**
- * Protobuf enum <code>Google\Protobuf\Internal</code>
+ * Protobuf type <code>google.protobuf.FieldOptions.JSType</code>
*/
-class FieldOptions_JSType
+class JSType
{
/**
* Use the default type.
@@ -29,3 +29,6 @@ class FieldOptions_JSType
const JS_NUMBER = 2;
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(JSType::class, \Google\Protobuf\Internal\FieldOptions_JSType::class);
+
diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php
index 2315ed5e..c6b36bbc 100644
--- a/php/src/Google/Protobuf/Internal/FileOptions.php
+++ b/php/src/Google/Protobuf/Internal/FileOptions.php
@@ -278,6 +278,14 @@ class FileOptions extends \Google\Protobuf\Internal\Message
* Use this option to change the namespace of php generated classes. Default
* is empty. When this option is empty, the package name will be used for
* determining the namespace.
+ * @type string $php_metadata_namespace
+ * Use this option to change the namespace of php generated metadata classes.
+ * Default is empty. When this option is empty, the proto file name will be used
+ * for determining the namespace.
+ * @type string $ruby_package
+ * Use this option to change the package of ruby generated classes. Default
+ * is empty. When this option is not set, the package name will be used for
+ * determining the ruby package.
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here.
* See the documentation for the "Options" section above.
diff --git a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php
index 4dd56ef8..3dd60bf6 100644
--- a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
+++ b/php/src/Google/Protobuf/Internal/FileOptions/OptimizeMode.php
@@ -2,14 +2,14 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\FileOptions;
/**
* Generated classes can be optimized for speed or code size.
*
- * Protobuf enum <code>Google\Protobuf\Internal</code>
+ * Protobuf type <code>google.protobuf.FileOptions.OptimizeMode</code>
*/
-class FileOptions_OptimizeMode
+class OptimizeMode
{
/**
* Generate complete code for parsing, serialization,
@@ -31,3 +31,6 @@ class FileOptions_OptimizeMode
const LITE_RUNTIME = 3;
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(OptimizeMode::class, \Google\Protobuf\Internal\FileOptions_OptimizeMode::class);
+
diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php
index 05d5c393..023b07f4 100644
--- a/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ b/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -191,7 +191,7 @@ class GPBUtil
$var = boolval($var);
}
- public static function checkMessage(&$var, $klass)
+ public static function checkMessage(&$var, $klass, $newClass = null)
{
if (!$var instanceof $klass && !is_null($var)) {
throw new \Exception("Expect $klass.");
@@ -303,8 +303,11 @@ class GPBUtil
$name,
$file_proto)
{
- $classname = implode('_', explode('.', $name));
- return static::getClassNamePrefix($classname, $file_proto) . $classname;
+ $parts = explode('.', $name);
+ foreach ($parts as $i => $part) {
+ $parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i];
+ }
+ return implode('\\', $parts);
}
public static function getFullClassName(
@@ -347,9 +350,14 @@ class GPBUtil
if ($package === "") {
$classname = $class_name_without_package;
} else {
+ $parts = array_map('ucwords', explode('.', $package));
+ foreach ($parts as $i => $part) {
+ $parts[$i] = self::getClassNamePrefix($part, $file_proto).$part;
+ }
$classname =
- implode('\\', array_map('ucwords', explode('.', $package))).
- "\\".$class_name_without_package;
+ implode('\\', $parts) .
+ "\\".self::getClassNamePrefix($class_name_without_package,$file_proto).
+ $class_name_without_package;
}
}
diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
index c2b41a29..f5a65bea 100644
--- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
+++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
@@ -34,7 +34,7 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
- * @type \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotation
+ * @type \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotation
* An Annotation connects some span of text in generated code to an element
* of its generating .proto file.
* }
@@ -61,12 +61,12 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
* of its generating .proto file.
*
* Generated from protobuf field <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
- * @param \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAnnotation($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation::class);
$this->annotation = $arr;
$this->has_annotation = true;
diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php
index 75182007..09f958d2 100644
--- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
+++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\GeneratedCodeInfo;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>google.protobuf.GeneratedCodeInfo.Annotation</code>
*/
-class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
+class Annotation extends \Google\Protobuf\Internal\Message
{
/**
* Identifies the element in the original source .proto file. This field
@@ -211,3 +211,6 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Annotation::class, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class);
+
diff --git a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php
index 9e06d8ee..dcc30e27 100644
--- a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
+++ b/php/src/Google/Protobuf/Internal/MethodOptions/IdempotencyLevel.php
@@ -2,16 +2,16 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\MethodOptions;
/**
* Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
* or neither? HTTP based RPC implementation may choose GET verb for safe
* methods, and PUT verb for idempotent methods instead of the default POST.
*
- * Protobuf enum <code>Google\Protobuf\Internal</code>
+ * Protobuf type <code>google.protobuf.MethodOptions.IdempotencyLevel</code>
*/
-class MethodOptions_IdempotencyLevel
+class IdempotencyLevel
{
/**
* Generated from protobuf enum <code>IDEMPOTENCY_UNKNOWN = 0;</code>
@@ -31,3 +31,6 @@ class MethodOptions_IdempotencyLevel
const IDEMPOTENT = 2;
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(IdempotencyLevel::class, \Google\Protobuf\Internal\MethodOptions_IdempotencyLevel::class);
+
diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
index 2305a792..6e413f77 100644
--- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
+++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
@@ -72,7 +72,7 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
- * @type \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $location
+ * @type \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $location
* A Location identifies a piece of source code in a .proto file which
* corresponds to a particular definition. This information is intended
* to be useful to IDEs, code indexers, documentation generators, and similar
@@ -216,12 +216,12 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
* be recorded in the future.
*
* Generated from protobuf field <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
- * @param \Google\Protobuf\Internal\SourceCodeInfo_Location[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLocation($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo\Location::class);
$this->location = $arr;
$this->has_location = true;
diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php
index f930aac1..bad247a1 100644
--- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
+++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\SourceCodeInfo;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -13,7 +13,7 @@ use Google\Protobuf\Internal\GPBUtil;
/**
* Generated from protobuf message <code>google.protobuf.SourceCodeInfo.Location</code>
*/
-class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
+class Location extends \Google\Protobuf\Internal\Message
{
/**
* Identifies which part of the FileDescriptorProto was defined at this
@@ -458,3 +458,6 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Location::class, \Google\Protobuf\Internal\SourceCodeInfo_Location::class);
+
diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php
index 36a18688..3b517ec5 100644
--- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php
+++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php
@@ -67,7 +67,7 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
- * @type \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $name
+ * @type \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $name
* @type string $identifier_value
* The value of the uninterpreted option, in whatever type the tokenizer
* identified it as during parsing. Exactly one of these should be set.
@@ -94,12 +94,12 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
- * @param \Google\Protobuf\Internal\UninterpretedOption_NamePart[]|\Google\Protobuf\Internal\RepeatedField $var
+ * @param \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setName($var)
{
- $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class);
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption\NamePart::class);
$this->name = $arr;
$this->has_name = true;
diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php
index d4369fda..92ee4b44 100644
--- a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
+++ b/php/src/Google/Protobuf/Internal/UninterpretedOption/NamePart.php
@@ -2,7 +2,7 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
-namespace Google\Protobuf\Internal;
+namespace Google\Protobuf\Internal\UninterpretedOption;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBWire;
@@ -19,7 +19,7 @@ use Google\Protobuf\Internal\GPBUtil;
*
* Generated from protobuf message <code>google.protobuf.UninterpretedOption.NamePart</code>
*/
-class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
+class NamePart extends \Google\Protobuf\Internal\Message
{
/**
* Generated from protobuf field <code>required string name_part = 1;</code>
@@ -105,3 +105,6 @@ class UninterpretedOption_NamePart extends \Google\Protobuf\Internal\Message
}
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(NamePart::class, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class);
+
diff --git a/php/src/Google/Protobuf/ListValue.php b/php/src/Google/Protobuf/ListValue.php
index 12552ef4..70f54232 100644
--- a/php/src/Google/Protobuf/ListValue.php
+++ b/php/src/Google/Protobuf/ListValue.php
@@ -23,9 +23,19 @@ class ListValue extends \Google\Protobuf\Internal\Message
*/
private $values;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $values
+ * Repeated field of dynamically typed values.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Struct::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Method.php b/php/src/Google/Protobuf/Method.php
index f55cb764..8e803506 100644
--- a/php/src/Google/Protobuf/Method.php
+++ b/php/src/Google/Protobuf/Method.php
@@ -58,9 +58,31 @@ class Method extends \Google\Protobuf\Internal\Message
*/
private $syntax = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The simple name of this method.
+ * @type string $request_type_url
+ * A URL of the input message type.
+ * @type bool $request_streaming
+ * If true, the request is streamed.
+ * @type string $response_type_url
+ * The URL of the output message type.
+ * @type bool $response_streaming
+ * If true, the response is streamed.
+ * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
+ * Any metadata attached to the method.
+ * @type int $syntax
+ * The source syntax of this method.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Api::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Mixin.php b/php/src/Google/Protobuf/Mixin.php
index eb5117e0..a2ea59c7 100644
--- a/php/src/Google/Protobuf/Mixin.php
+++ b/php/src/Google/Protobuf/Mixin.php
@@ -90,9 +90,22 @@ class Mixin extends \Google\Protobuf\Internal\Message
*/
private $root = '';
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The fully qualified name of the interface which is included.
+ * @type string $root
+ * If non-empty specifies a path under which inherited HTTP paths
+ * are rooted.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Api::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/NullValue.php b/php/src/Google/Protobuf/NullValue.php
index d4022ccc..482b80dd 100644
--- a/php/src/Google/Protobuf/NullValue.php
+++ b/php/src/Google/Protobuf/NullValue.php
@@ -9,7 +9,7 @@ namespace Google\Protobuf;
* `Value` type union.
* The JSON representation for `NullValue` is JSON `null`.
*
- * Protobuf enum <code>Google\Protobuf\NullValue</code>
+ * Protobuf type <code>google.protobuf.NullValue</code>
*/
class NullValue
{
diff --git a/php/src/Google/Protobuf/Option.php b/php/src/Google/Protobuf/Option.php
index f8038681..22ecfc5f 100644
--- a/php/src/Google/Protobuf/Option.php
+++ b/php/src/Google/Protobuf/Option.php
@@ -35,9 +35,27 @@ class Option extends \Google\Protobuf\Internal\Message
*/
private $value = null;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The option's name. For protobuf built-in options (options defined in
+ * descriptor.proto), this is the short name. For example, `"map_entry"`.
+ * For custom options, it should be the fully-qualified name. For example,
+ * `"google.api.http"`.
+ * @type \Google\Protobuf\Any $value
+ * The option's value packed in an Any message. If the value is a primitive,
+ * the corresponding wrapper type defined in google/protobuf/wrappers.proto
+ * should be used. If the value is an enum, it should be stored as an int32
+ * value using the google.protobuf.Int32Value type.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/SourceContext.php b/php/src/Google/Protobuf/SourceContext.php
index 07d90c68..cbc50c68 100644
--- a/php/src/Google/Protobuf/SourceContext.php
+++ b/php/src/Google/Protobuf/SourceContext.php
@@ -24,9 +24,20 @@ class SourceContext extends \Google\Protobuf\Internal\Message
*/
private $file_name = '';
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $file_name
+ * The path-qualified name of the .proto file that contained the associated
+ * protobuf element. For example: `"google/protobuf/source_context.proto"`.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\SourceContext::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/StringValue.php b/php/src/Google/Protobuf/StringValue.php
index f6bcc48a..8fb354f3 100644
--- a/php/src/Google/Protobuf/StringValue.php
+++ b/php/src/Google/Protobuf/StringValue.php
@@ -23,9 +23,19 @@ class StringValue extends \Google\Protobuf\Internal\Message
*/
private $value = '';
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $value
+ * The string value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Struct.php b/php/src/Google/Protobuf/Struct.php
index 721e991c..0456541c 100644
--- a/php/src/Google/Protobuf/Struct.php
+++ b/php/src/Google/Protobuf/Struct.php
@@ -28,9 +28,19 @@ class Struct extends \Google\Protobuf\Internal\Message
*/
private $fields;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type array|\Google\Protobuf\Internal\MapField $fields
+ * Unordered map of dynamically typed values.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Struct::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Syntax.php b/php/src/Google/Protobuf/Syntax.php
index bb7b7896..3a52dc9e 100644
--- a/php/src/Google/Protobuf/Syntax.php
+++ b/php/src/Google/Protobuf/Syntax.php
@@ -7,7 +7,7 @@ namespace Google\Protobuf;
/**
* The syntax in which a protocol buffer element is defined.
*
- * Protobuf enum <code>Google\Protobuf\Syntax</code>
+ * Protobuf type <code>google.protobuf.Syntax</code>
*/
class Syntax
{
diff --git a/php/src/Google/Protobuf/Timestamp.php b/php/src/Google/Protobuf/Timestamp.php
index f2286ab4..e21f3231 100644
--- a/php/src/Google/Protobuf/Timestamp.php
+++ b/php/src/Google/Protobuf/Timestamp.php
@@ -89,9 +89,26 @@ class Timestamp extends \Google\Protobuf\Internal\Message
*/
private $nanos = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int|string $seconds
+ * Represents seconds of UTC time since Unix epoch
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
+ * 9999-12-31T23:59:59Z inclusive.
+ * @type int $nanos
+ * Non-negative fractions of a second at nanosecond resolution. Negative
+ * second values with fractions must still have non-negative nanos values
+ * that count forward in time. Must be from 0 to 999,999,999
+ * inclusive.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Timestamp::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
@@ -156,7 +173,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
return $this;
}
- /**
+ /*
* Converts PHP DateTime to Timestamp.
*
* @param \DateTime $datetime
diff --git a/php/src/Google/Protobuf/Type.php b/php/src/Google/Protobuf/Type.php
index 7dbe2cab..1b478110 100644
--- a/php/src/Google/Protobuf/Type.php
+++ b/php/src/Google/Protobuf/Type.php
@@ -52,9 +52,29 @@ class Type extends \Google\Protobuf\Internal\Message
*/
private $syntax = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type string $name
+ * The fully qualified message name.
+ * @type \Google\Protobuf\Field[]|\Google\Protobuf\Internal\RepeatedField $fields
+ * The list of fields.
+ * @type string[]|\Google\Protobuf\Internal\RepeatedField $oneofs
+ * The list of types appearing in `oneof` definitions in this type.
+ * @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
+ * The protocol buffer options.
+ * @type \Google\Protobuf\SourceContext $source_context
+ * The source context.
+ * @type int $syntax
+ * The source syntax.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Type::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/UInt32Value.php b/php/src/Google/Protobuf/UInt32Value.php
index 61a3ddf1..f5a522d2 100644
--- a/php/src/Google/Protobuf/UInt32Value.php
+++ b/php/src/Google/Protobuf/UInt32Value.php
@@ -23,9 +23,19 @@ class UInt32Value extends \Google\Protobuf\Internal\Message
*/
private $value = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $value
+ * The uint32 value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/UInt64Value.php b/php/src/Google/Protobuf/UInt64Value.php
index 69f7eb8e..89e69cd8 100644
--- a/php/src/Google/Protobuf/UInt64Value.php
+++ b/php/src/Google/Protobuf/UInt64Value.php
@@ -23,9 +23,19 @@ class UInt64Value extends \Google\Protobuf\Internal\Message
*/
private $value = 0;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int|string $value
+ * The uint64 value.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Wrappers::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**
diff --git a/php/src/Google/Protobuf/Value.php b/php/src/Google/Protobuf/Value.php
index 052a3779..5c1e864c 100644
--- a/php/src/Google/Protobuf/Value.php
+++ b/php/src/Google/Protobuf/Value.php
@@ -21,9 +21,29 @@ class Value extends \Google\Protobuf\Internal\Message
{
protected $kind;
- public function __construct() {
+ /**
+ * Constructor.
+ *
+ * @param array $data {
+ * Optional. Data for populating the Message object.
+ *
+ * @type int $null_value
+ * Represents a null value.
+ * @type float $number_value
+ * Represents a double value.
+ * @type string $string_value
+ * Represents a string value.
+ * @type bool $bool_value
+ * Represents a boolean value.
+ * @type \Google\Protobuf\Struct $struct_value
+ * Represents a structured value.
+ * @type \Google\Protobuf\ListValue $list_value
+ * Represents a repeated `Value`.
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Struct::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**