ADD: added new version of protobuf

This commit is contained in:
Henry Winkel
2022-12-20 10:09:28 +01:00
parent 4a79559129
commit 1e2b3dda7b
1513 changed files with 123720 additions and 83381 deletions

View File

@@ -31,7 +31,6 @@ class Descriptor
->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 8, 'google.protobuf.internal.FileOptions')
->optional('source_code_info', \Google\Protobuf\Internal\GPBType::MESSAGE, 9, 'google.protobuf.internal.SourceCodeInfo')
->optional('syntax', \Google\Protobuf\Internal\GPBType::STRING, 12)
->optional('edition', \Google\Protobuf\Internal\GPBType::STRING, 13)
->finalizeToPool();
$pool->addMessage('google.protobuf.internal.DescriptorProto', \Google\Protobuf\Internal\DescriptorProto::class)

View File

@@ -74,8 +74,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
* implementation must either *always* check its required fields, or *never*
* check its required fields, regardless of whether or not the message has
* been parsed.
* As of May 2022, lazy verifies the contents of the byte stream during
* parsing. An invalid byte stream will cause the overall parsing to fail.
* As of 2021, lazy does no correctness checks on the byte stream during
* parsing. This may lead to crashes if and when an invalid byte stream is
* finally parsed upon access.
* TODO(b/211906113): Enable validation on lazy fields.
*
* Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
*/
@@ -163,8 +165,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
* implementation must either *always* check its required fields, or *never*
* check its required fields, regardless of whether or not the message has
* been parsed.
* As of May 2022, lazy verifies the contents of the byte stream during
* parsing. An invalid byte stream will cause the overall parsing to fail.
* As of 2021, lazy does no correctness checks on the byte stream during
* parsing. This may lead to crashes if and when an invalid byte stream is
* finally parsed upon access.
* TODO(b/211906113): Enable validation on lazy fields.
* @type bool $unverified_lazy
* unverified_lazy does no correctness checks on the byte stream. This should
* only be used where lazy with verification is prohibitive for performance
@@ -350,8 +354,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
* implementation must either *always* check its required fields, or *never*
* check its required fields, regardless of whether or not the message has
* been parsed.
* As of May 2022, lazy verifies the contents of the byte stream during
* parsing. An invalid byte stream will cause the overall parsing to fail.
* As of 2021, lazy does no correctness checks on the byte stream during
* parsing. This may lead to crashes if and when an invalid byte stream is
* finally parsed upon access.
* TODO(b/211906113): Enable validation on lazy fields.
*
* Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
* @return bool
@@ -396,8 +402,10 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
* implementation must either *always* check its required fields, or *never*
* check its required fields, regardless of whether or not the message has
* been parsed.
* As of May 2022, lazy verifies the contents of the byte stream during
* parsing. An invalid byte stream will cause the overall parsing to fail.
* As of 2021, lazy does no correctness checks on the byte stream during
* parsing. This may lead to crashes if and when an invalid byte stream is
* finally parsed upon access.
* TODO(b/211906113): Enable validation on lazy fields.
*
* Generated from protobuf field <code>optional bool lazy = 5 [default = false];</code>
* @param bool $var

View File

@@ -81,18 +81,11 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
protected $source_code_info = null;
/**
* The syntax of the proto file.
* The supported values are "proto2", "proto3", and "editions".
* If `edition` is present, this value must be "editions".
* The supported values are "proto2" and "proto3".
*
* Generated from protobuf field <code>optional string syntax = 12;</code>
*/
protected $syntax = null;
/**
* The edition of the proto file, which is an opaque string.
*
* Generated from protobuf field <code>optional string edition = 13;</code>
*/
protected $edition = null;
/**
* Constructor.
@@ -124,10 +117,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
* development tools.
* @type string $syntax
* The syntax of the proto file.
* The supported values are "proto2", "proto3", and "editions".
* If `edition` is present, this value must be "editions".
* @type string $edition
* The edition of the proto file, which is an opaque string.
* The supported values are "proto2" and "proto3".
* }
*/
public function __construct($data = NULL) {
@@ -455,8 +445,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
/**
* The syntax of the proto file.
* The supported values are "proto2", "proto3", and "editions".
* If `edition` is present, this value must be "editions".
* The supported values are "proto2" and "proto3".
*
* Generated from protobuf field <code>optional string syntax = 12;</code>
* @return string
@@ -478,8 +467,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
/**
* The syntax of the proto file.
* The supported values are "proto2", "proto3", and "editions".
* If `edition` is present, this value must be "editions".
* The supported values are "proto2" and "proto3".
*
* Generated from protobuf field <code>optional string syntax = 12;</code>
* @param string $var
@@ -493,41 +481,5 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
return $this;
}
/**
* The edition of the proto file, which is an opaque string.
*
* Generated from protobuf field <code>optional string edition = 13;</code>
* @return string
*/
public function getEdition()
{
return isset($this->edition) ? $this->edition : '';
}
public function hasEdition()
{
return isset($this->edition);
}
public function clearEdition()
{
unset($this->edition);
}
/**
* The edition of the proto file, which is an opaque string.
*
* Generated from protobuf field <code>optional string edition = 13;</code>
* @param string $var
* @return $this
*/
public function setEdition($var)
{
GPBUtil::checkString($var, True);
$this->edition = $var;
return $this;
}
}

View File

@@ -54,7 +54,6 @@ use Google\Protobuf\NullValue;
* or extend this class or its child classes by their own. See the comment of
* specific functions for more details.
*/
#[\AllowDynamicProperties]
class Message
{
@@ -1981,12 +1980,8 @@ class Message
$size += 9;
$size += $value_msg->jsonByteSize();
} else {
$value_size = $value_msg->jsonByteSize();
// size === 2 it's empty message {} which is not serialized inside any
if ($value_size !== 2) {
// Size for value. +1 for comma, -2 for "{}".
$size += $value_size -1;
}
// Size for value. +1 for comma, -2 for "{}".
$size += $value_msg->jsonByteSize() -1;
}
} elseif (get_class($this) === 'Google\Protobuf\FieldMask') {
$field_mask = GPBUtil::formatFieldMask($this);

View File

@@ -53,9 +53,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
*/
protected $deprecated = null;
/**
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
* Whether the message is an automatically generated map entry type for the
* maps field.
* For maps fields:
@@ -71,6 +68,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* use a native map in the target language to hold the keys and values.
* The reflection APIs in such implementations still need to work as
* if the field is a repeated message field.
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
*
* Generated from protobuf field <code>optional bool map_entry = 7;</code>
*/
@@ -114,9 +114,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* for the message, or it will be completely ignored; in the very least,
* this is a formalization for deprecating messages.
* @type bool $map_entry
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
* Whether the message is an automatically generated map entry type for the
* maps field.
* For maps fields:
@@ -132,6 +129,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* use a native map in the target language to hold the keys and values.
* The reflection APIs in such implementations still need to work as
* if the field is a repeated message field.
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
@@ -288,9 +288,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
}
/**
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
* Whether the message is an automatically generated map entry type for the
* maps field.
* For maps fields:
@@ -306,6 +303,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* use a native map in the target language to hold the keys and values.
* The reflection APIs in such implementations still need to work as
* if the field is a repeated message field.
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
*
* Generated from protobuf field <code>optional bool map_entry = 7;</code>
* @return bool
@@ -326,9 +326,6 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
}
/**
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
* Whether the message is an automatically generated map entry type for the
* maps field.
* For maps fields:
@@ -344,6 +341,9 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* use a native map in the target language to hold the keys and values.
* The reflection APIs in such implementations still need to work as
* if the field is a repeated message field.
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
*
* Generated from protobuf field <code>optional bool map_entry = 7;</code>
* @param bool $var