From f1911f37f817fb2dddbb07478bdcda526488fc55 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Wed, 2 May 2018 14:40:15 -0700 Subject: 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 --- .../Google/Protobuf/Internal/EnumValueDescriptorProto.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php') diff --git a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php index e363220f..50bda008 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php @@ -33,9 +33,20 @@ class EnumValueDescriptorProto extends \Google\Protobuf\Internal\Message private $options = null; private $has_options = false; - public function __construct() { + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * @type int $number + * @type \Google\Protobuf\Internal\EnumValueOptions $options + * } + */ + public function __construct($data = NULL) { \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); - parent::__construct(); + parent::__construct($data); } /** -- cgit v1.2.3