aboutsummaryrefslogtreecommitdiff
path: root/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
diff options
context:
space:
mode:
authorBrent Shaffer <betterbrent@google.com>2018-05-02 14:40:15 -0700
committerBo Yang <teboring@google.com>2018-05-15 09:48:43 -0700
commitca07512bac51667feb0ed999ac09fe1b92c9e4ec (patch)
treec435922825f3e6e124258695011d4394b44ff1d2 /php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
parentb83b8e3d448fa5395792630a61aad5e09ff74552 (diff)
downloadprotobuf-ca07512bac51667feb0ed999ac09fe1b92c9e4ec.tar.gz
protobuf-ca07512bac51667feb0ed999ac09fe1b92c9e4ec.tar.bz2
protobuf-ca07512bac51667feb0ed999ac09fe1b92c9e4ec.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/FieldDescriptorProto.php')
-rw-r--r--php/src/Google/Protobuf/Internal/FieldDescriptorProto.php42
1 files changed, 40 insertions, 2 deletions
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
index 10c27593..e5781975 100644
--- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
@@ -94,9 +94,47 @@ class FieldDescriptorProto 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 int $label
+ * @type int $type
+ * If type_name is set, this need not be set. If both this and type_name
+ * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
+ * @type string $type_name
+ * For message and enum types, this is the name of the type. If the name
+ * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
+ * rules are used to find the type (i.e. first the nested types within this
+ * message are searched, then within the parent, on up to the root
+ * namespace).
+ * @type string $extendee
+ * For extensions, this is the name of the type being extended. It is
+ * resolved in the same manner as type_name.
+ * @type string $default_value
+ * For numeric types, contains the original text representation of the value.
+ * For booleans, "true" or "false".
+ * For strings, contains the default text contents (not escaped in any way).
+ * For bytes, contains the C escaped value. All bytes >= 128 are escaped.
+ * TODO(kenton): Base-64 encode?
+ * @type int $oneof_index
+ * If set, gives the index of a oneof in the containing type's oneof_decl
+ * list. This field is a member of that oneof.
+ * @type string $json_name
+ * JSON name of this field. The value is set by protocol compiler. If the
+ * user has set a "json_name" option on this field, that option's value
+ * will be used. Otherwise, it's deduced from the field's name by converting
+ * it to camelCase.
+ * @type \Google\Protobuf\Internal\FieldOptions $options
+ * }
+ */
+ public function __construct($data = NULL) {
\GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce();
- parent::__construct();
+ parent::__construct($data);
}
/**