diff options
author | Brent Shaffer <betterbrent@google.com> | 2018-05-02 14:40:15 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2018-05-25 13:03:58 -0700 |
commit | c9b404d23bdf3dd8f1556b19a27dcba40565e3e4 (patch) | |
tree | e62606471c739037a4f7e40757c26f0225b15649 /php/src/Google/Protobuf/Internal/DescriptorProto.php | |
parent | 7eba62465375b15a28d3f7bbd08f4f517b90b076 (diff) | |
download | protobuf-c9b404d23bdf3dd8f1556b19a27dcba40565e3e4.tar.gz protobuf-c9b404d23bdf3dd8f1556b19a27dcba40565e3e4.tar.bz2 protobuf-c9b404d23bdf3dd8f1556b19a27dcba40565e3e4.zip |
PHP array constructors for protobuf messages (#4530)
* PHP array constructors for protobuf messages
* removes Descriptor from error message
* allows mergeFrom to accept an array
* only use initWithDescriptor if instanceof MapEntry
* adds doc comments
* removes ability for constructors to take arrays for submessages
* Revert "allows mergeFrom to accept an array"
This reverts commit b7b72182d561634af12c5c5c56a7cda3b33241f9.
* makes mergeFromArray protected and fixes mergeFrom whitespace
* Separates merging from JSON and merging from PHP array
* removes well-known types and json keys from array construction
* Addresses PR review comments
* cleans up tests
* fixes exception messages
Diffstat (limited to 'php/src/Google/Protobuf/Internal/DescriptorProto.php')
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorProto.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php index 1d6959b7..4676269e 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -71,9 +71,29 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message private $reserved_name; private $has_reserved_name = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $field + * @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\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 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. + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); + parent::__construct($data); } /** |