diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-10-11 14:44:03 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-10-11 14:44:03 -0700 |
commit | de15e73d5862e8ac618bc7be90594adacbaa1ec6 (patch) | |
tree | 9d1f71f76902010963e0dc28db266de22b82646d /php | |
parent | c4083bb3d1231f8a94f2f000434e38528bdff64a (diff) | |
parent | bd798dfc81443cb95ff3b6e0b787c92031b113e5 (diff) |
Merge remote-tracking branch 'origin/3.4.x' into master
Diffstat (limited to 'php')
-rw-r--r-- | php/ext/google/protobuf/def.c | 17 | ||||
-rw-r--r-- | php/ext/google/protobuf/package.xml | 24 | ||||
-rw-r--r-- | php/ext/google/protobuf/protobuf.c | 43 | ||||
-rw-r--r-- | php/ext/google/protobuf/protobuf.h | 28 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php | 109 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php | 64 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/GPBUtil.php | 31 | ||||
-rw-r--r-- | php/tests/generated_class_test.php | 444 | ||||
-rw-r--r-- | php/tests/proto/test_reserved_enum_lower.proto | 77 | ||||
-rw-r--r-- | php/tests/proto/test_reserved_enum_upper.proto | 77 | ||||
-rw-r--r-- | php/tests/proto/test_reserved_enum_value_lower.proto | 79 | ||||
-rw-r--r-- | php/tests/proto/test_reserved_enum_value_upper.proto | 79 | ||||
-rw-r--r-- | php/tests/proto/test_reserved_message_lower.proto | 77 | ||||
-rw-r--r-- | php/tests/proto/test_reserved_message_upper.proto | 77 |
14 files changed, 1205 insertions, 21 deletions
diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c index 421b84e5..13f7cdd6 100644 --- a/php/ext/google/protobuf/def.c +++ b/php/ext/google/protobuf/def.c @@ -30,9 +30,6 @@ #include "protobuf.h" -const char* const kReservedNames[] = {"Empty", "ECHO", "ARRAY"}; -const int kReservedNamesSize = 3; - // Forward declare. static void descriptor_init_c_instance(Descriptor* intern TSRMLS_DC); static void descriptor_free_c(Descriptor* object TSRMLS_DC); @@ -747,12 +744,16 @@ static const char *classname_prefix(const char *classname, return prefix_given; } - for (i = 0; i < kReservedNamesSize; i++) { - if (strcmp(kReservedNames[i], classname) == 0) { - is_reserved = true; - break; - } + char* lower = ALLOC_N(char, strlen(classname) + 1); + i = 0; + while(classname[i]) { + lower[i] = (char)tolower(classname[i]); + i++; } + lower[i] = 0; + + is_reserved = is_reserved_name(lower); + FREE(lower); if (is_reserved) { if (package_name != NULL && strcmp("google.protobuf", package_name) == 0) { diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 2d318517..4a473801 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,11 +10,11 @@ <email>protobuf-opensource@google.com</email> <active>yes</active> </lead> - <date>2017-01-13</date> - <time>16:06:07</time> + <date>2017-09-14</date> + <time>11:02:07</time> <version> - <release>3.4.0</release> - <api>3.4.0</api> + <release>3.4.1</release> + <api>3.4.1</api> </version> <stability> <release>stable</release> @@ -152,5 +152,21 @@ GA release. GA release. </notes> </release> + <release> + <version> + <release>3.4.1</release> + <api>3.4.1</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2017-09-14</date> + <time>11:02:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +GA release. + </notes> + </release> </changelog> </package> diff --git a/php/ext/google/protobuf/protobuf.c b/php/ext/google/protobuf/protobuf.c index 2f394ba5..b67089e0 100644 --- a/php/ext/google/protobuf/protobuf.c +++ b/php/ext/google/protobuf/protobuf.c @@ -49,6 +49,7 @@ static HashTable* ce_to_php_obj_map; // Global map from message/enum's proto fully-qualified name to corresponding // wrapper Descriptor/EnumDescriptor instances. static HashTable* proto_to_php_obj_map; +static HashTable* reserved_names; // ----------------------------------------------------------------------------- // Global maps. @@ -144,6 +145,36 @@ PHP_PROTO_HASHTABLE_VALUE get_proto_obj(const char* proto) { } // ----------------------------------------------------------------------------- +// Reserved Name. +// ----------------------------------------------------------------------------- + +// Although we already have kReservedNames, we still add them to hash table to +// speed up look up. +const char *const kReservedNames[] = { + "abstract", "and", "array", "as", "break", + "callable", "case", "catch", "class", "clone", + "const", "continue", "declare", "default", "die", + "do", "echo", "else", "elseif", "empty", + "enddeclare", "endfor", "endforeach", "endif", "endswitch", + "endwhile", "eval", "exit", "extends", "final", + "for", "foreach", "function", "global", "goto", + "if", "implements", "include", "include_once", "instanceof", + "insteadof", "interface", "isset", "list", "namespace", + "new", "or", "print", "private", "protected", + "public", "require", "require_once", "return", "static", + "switch", "throw", "trait", "try", "unset", + "use", "var", "while", "xor", "int", + "float", "bool", "string", "true", "false", + "null", "void", "iterable"}; +const int kReservedNamesSize = 73; + +bool is_reserved_name(const char* name) { + void** value; + return (php_proto_zend_hash_find(reserved_names, name, strlen(name), + (void**)&value) == SUCCESS); +} + +// ----------------------------------------------------------------------------- // Utilities. // ----------------------------------------------------------------------------- @@ -190,6 +221,8 @@ static void php_proto_hashtable_descriptor_release(zval* value) { #endif static PHP_RINIT_FUNCTION(protobuf) { + int i = 0; + ALLOC_HASHTABLE(upb_def_to_php_obj_map); zend_hash_init(upb_def_to_php_obj_map, 16, NULL, HASHTABLE_VALUE_DTOR, 0); @@ -199,6 +232,13 @@ static PHP_RINIT_FUNCTION(protobuf) { ALLOC_HASHTABLE(proto_to_php_obj_map); zend_hash_init(proto_to_php_obj_map, 16, NULL, HASHTABLE_VALUE_DTOR, 0); + ALLOC_HASHTABLE(reserved_names); + zend_hash_init(reserved_names, 16, NULL, NULL, 0); + for (i = 0; i < kReservedNamesSize; i++) { + php_proto_zend_hash_update(reserved_names, kReservedNames[i], + strlen(kReservedNames[i])); + } + generated_pool = NULL; generated_pool_php = NULL; internal_generated_pool_php = NULL; @@ -216,6 +256,9 @@ static PHP_RSHUTDOWN_FUNCTION(protobuf) { zend_hash_destroy(proto_to_php_obj_map); FREE_HASHTABLE(proto_to_php_obj_map); + zend_hash_destroy(reserved_names); + FREE_HASHTABLE(reserved_names); + #if PHP_MAJOR_VERSION < 7 if (generated_pool_php != NULL) { zval_dtor(generated_pool_php); diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index c8a360d8..cb098747 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -37,7 +37,7 @@ #include "upb.h" #define PHP_PROTOBUF_EXTNAME "protobuf" -#define PHP_PROTOBUF_VERSION "3.4.0" +#define PHP_PROTOBUF_VERSION "3.4.1" #define MAX_LENGTH_OF_INT64 20 #define SIZEOF_INT64 8 @@ -80,6 +80,9 @@ #define php_proto_zend_hash_update_zval(ht, key, key_len, value) \ zend_hash_update(ht, key, key_len, value, sizeof(void*), NULL) +#define php_proto_zend_hash_update(ht, key, key_len) \ + zend_hash_update(ht, key, key_len, 0, 0, NULL) + #define php_proto_zend_hash_index_update_mem(ht, h, pData, nDataSize, pDest) \ zend_hash_index_update(ht, h, pData, nDataSize, pDest) @@ -90,6 +93,9 @@ #define php_proto_zend_hash_index_find_zval(ht, h, pDest) \ zend_hash_index_find(ht, h, pDest) +#define php_proto_zend_hash_find(ht, key, key_len, pDest) \ + zend_hash_find(ht, key, key_len, pDest) + #define php_proto_zend_hash_index_find_mem(ht, h, pDest) \ zend_hash_index_find(ht, h, pDest) @@ -270,6 +276,15 @@ static inline int php_proto_zend_hash_index_update_zval(HashTable* ht, ulong h, return result != NULL ? SUCCESS : FAILURE; } +static inline int php_proto_zend_hash_update(HashTable* ht, const char* key, + size_t key_len) { + void* result = NULL; + zval temp; + ZVAL_LONG(&temp, 0); + result = zend_hash_str_update(ht, key, key_len, &temp); + return result != NULL ? SUCCESS : FAILURE; +} + static inline int php_proto_zend_hash_index_update_mem(HashTable* ht, ulong h, void* pData, uint nDataSize, void** pDest) { @@ -303,6 +318,13 @@ static inline int php_proto_zend_hash_index_find_zval(const HashTable* ht, return result != NULL ? SUCCESS : FAILURE; } +static inline int php_proto_zend_hash_find(const HashTable* ht, const char* key, + size_t key_len, void** pDest) { + void* result = NULL; + result = zend_hash_str_find(ht, key, key_len); + return result != NULL ? SUCCESS : FAILURE; +} + static inline int php_proto_zend_hash_index_find_mem(const HashTable* ht, ulong h, void** pDest) { void* result = NULL; @@ -1413,4 +1435,8 @@ static inline zval* php_proto_message_read_property( #endif } +// Reserved name +bool is_reserved_name(const char* name); +bool is_valid_constant_name(const char* name); + #endif // __GOOGLE_PROTOBUF_PHP_PROTOBUF_H__ diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php new file mode 100644 index 00000000..6b2449fa --- /dev/null +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php @@ -0,0 +1,109 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + * + * Generated from protobuf message <code>google.protobuf.EnumDescriptorProto.EnumReservedRange</code> + */ +class EnumDescriptorProto_EnumReservedRange extends \Google\Protobuf\Internal\Message +{ + /** + * Inclusive. + * + * Generated from protobuf field <code>optional int32 start = 1;</code> + */ + private $start = 0; + private $has_start = false; + /** + * Inclusive. + * + * Generated from protobuf field <code>optional int32 end = 2;</code> + */ + private $end = 0; + private $has_end = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * Inclusive. + * + * Generated from protobuf field <code>optional int32 start = 1;</code> + * @return int + */ + public function getStart() + { + return $this->start; + } + + /** + * Inclusive. + * + * Generated from protobuf field <code>optional int32 start = 1;</code> + * @param int $var + * @return $this + */ + public function setStart($var) + { + GPBUtil::checkInt32($var); + $this->start = $var; + $this->has_start = true; + + return $this; + } + + public function hasStart() + { + return $this->has_start; + } + + /** + * Inclusive. + * + * Generated from protobuf field <code>optional int32 end = 2;</code> + * @return int + */ + public function getEnd() + { + return $this->end; + } + + /** + * Inclusive. + * + * Generated from protobuf field <code>optional int32 end = 2;</code> + * @param int $var + * @return $this + */ + public function setEnd($var) + { + GPBUtil::checkInt32($var); + $this->end = $var; + $this->has_end = true; + + return $this; + } + + public function hasEnd() + { + return $this->has_end; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php b/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php new file mode 100644 index 00000000..ee9e38bb --- /dev/null +++ b/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php @@ -0,0 +1,64 @@ +<?php +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/protobuf/descriptor.proto + +namespace Google\Protobuf\Internal; + +use Google\Protobuf\Internal\GPBType; +use Google\Protobuf\Internal\GPBWire; +use Google\Protobuf\Internal\RepeatedField; +use Google\Protobuf\Internal\InputStream; +use Google\Protobuf\Internal\GPBUtil; + +/** + * Generated from protobuf message <code>google.protobuf.ExtensionRangeOptions</code> + */ +class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message +{ + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> + */ + private $uninterpreted_option; + private $has_uninterpreted_option = false; + + public function __construct() { + \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); + parent::__construct(); + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUninterpretedOption() + { + return $this->uninterpreted_option; + } + + /** + * The parser stores options it doesn't recognize here. See above. + * + * Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code> + * @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUninterpretedOption($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class); + $this->uninterpreted_option = $arr; + $this->has_uninterpreted_option = true; + + return $this; + } + + public function hasUninterpretedOption() + { + return $this->has_uninterpreted_option; + } + +} + diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php index a27220a0..7fa4a673 100644 --- a/php/src/Google/Protobuf/Internal/GPBUtil.php +++ b/php/src/Google/Protobuf/Internal/GPBUtil.php @@ -255,14 +255,29 @@ class GPBUtil return $prefix; } - $reserved_words = array("Empty", "ECHO", "ARRAY"); - foreach ($reserved_words as $reserved_word) { - if ($classname === $reserved_word) { - if ($file_proto->getPackage() === "google.protobuf") { - return "GPB"; - } else { - return "PB"; - } + $reserved_words = array( + "abstract"=>0, "and"=>0, "array"=>0, "as"=>0, "break"=>0, + "callable"=>0, "case"=>0, "catch"=>0, "class"=>0, "clone"=>0, + "const"=>0, "continue"=>0, "declare"=>0, "default"=>0, "die"=>0, + "do"=>0, "echo"=>0, "else"=>0, "elseif"=>0, "empty"=>0, + "enddeclare"=>0, "endfor"=>0, "endforeach"=>0, "endif"=>0, + "endswitch"=>0, "endwhile"=>0, "eval"=>0, "exit"=>0, "extends"=>0, + "final"=>0, "for"=>0, "foreach"=>0, "function"=>0, "global"=>0, + "goto"=>0, "if"=>0, "implements"=>0, "include"=>0, + "include_once"=>0, "instanceof"=>0, "insteadof"=>0, "interface"=>0, + "isset"=>0, "list"=>0, "namespace"=>0, "new"=>0, "or"=>0, + "print"=>0, "private"=>0, "protected"=>0, "public"=>0, "require"=>0, + "require_once"=>0, "return"=>0, "static"=>0, "switch"=>0, + "throw"=>0, "trait"=>0, "try"=>0, "unset"=>0, "use"=>0, "var"=>0, + "while"=>0, "xor"=>0, "int"=>0, "float"=>0, "bool"=>0, "string"=>0, + "true"=>0, "false"=>0, "null"=>0, "void"=>0, "iterable"=>0 + ); + + if (array_key_exists(strtolower($classname), $reserved_words)) { + if ($file_proto->getPackage() === "google.protobuf") { + return "GPB"; + } else { + return "PB"; } } diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php index 98918bce..53d18ee7 100644 --- a/php/tests/generated_class_test.php +++ b/php/tests/generated_class_test.php @@ -691,6 +691,450 @@ class GeneratedClassTest extends TestBase $m = new \Foo\PBEmpty(); $m = new \PrefixEmpty(); $m = new \Foo\PBARRAY(); + + $m = new \Lower\PBabstract(); + $m = new \Lower\PBand(); + $m = new \Lower\PBarray(); + $m = new \Lower\PBas(); + $m = new \Lower\PBbreak(); + $m = new \Lower\PBcallable(); + $m = new \Lower\PBcase(); + $m = new \Lower\PBcatch(); + $m = new \Lower\PBclass(); + $m = new \Lower\PBclone(); + $m = new \Lower\PBconst(); + $m = new \Lower\PBcontinue(); + $m = new \Lower\PBdeclare(); + $m = new \Lower\PBdefault(); + $m = new \Lower\PBdie(); + $m = new \Lower\PBdo(); + $m = new \Lower\PBecho(); + $m = new \Lower\PBelse(); + $m = new \Lower\PBelseif(); + $m = new \Lower\PBempty(); + $m = new \Lower\PBenddeclare(); + $m = new \Lower\PBendfor(); + $m = new \Lower\PBendforeach(); + $m = new \Lower\PBendif(); + $m = new \Lower\PBendswitch(); + $m = new \Lower\PBendwhile(); + $m = new \Lower\PBeval(); + $m = new \Lower\PBexit(); + $m = new \Lower\PBextends(); + $m = new \Lower\PBfinal(); + $m = new \Lower\PBfor(); + $m = new \Lower\PBforeach(); + $m = new \Lower\PBfunction(); + $m = new \Lower\PBglobal(); + $m = new \Lower\PBgoto(); + $m = new \Lower\PBif(); + $m = new \Lower\PBimplements(); + $m = new \Lower\PBinclude(); + $m = new \Lower\PBinclude_once(); + $m = new \Lower\PBinstanceof(); + $m = new \Lower\PBinsteadof(); + $m = new \Lower\PBinterface(); + $m = new \Lower\PBisset(); + $m = new \Lower\PBlist(); + $m = new \Lower\PBnamespace(); + $m = new \Lower\PBnew(); + $m = new \Lower\PBor(); + $m = new \Lower\PBprint(); + $m = new \Lower\PBprivate(); + $m = new \Lower\PBprotected(); + $m = new \Lower\PBpublic(); + $m = new \Lower\PBrequire(); + $m = new \Lower\PBrequire_once(); + $m = new \Lower\PBreturn(); + $m = new \Lower\PBstatic(); + $m = new \Lower\PBswitch(); + $m = new \Lower\PBthrow(); + $m = new \Lower\PBtrait(); + $m = new \Lower\PBtry(); + $m = new \Lower\PBunset(); + $m = new \Lower\PBuse(); + $m = new \Lower\PBvar(); + $m = new \Lower\PBwhile(); + $m = new \Lower\PBxor(); + $m = new \Lower\PBint(); + $m = new \Lower\PBfloat(); + $m = new \Lower\PBbool(); + $m = new \Lower\PBstring(); + $m = new \Lower\PBtrue(); + $m = new \Lower\PBfalse(); + $m = new \Lower\PBnull(); + $m = new \Lower\PBvoid(); + $m = new \Lower\PBiterable(); + + $m = new \Upper\PBABSTRACT(); + $m = new \Upper\PBAND(); + $m = new \Upper\PBARRAY(); + $m = new \Upper\PBAS(); + $m = new \Upper\PBBREAK(); + $m = new \Upper\PBCALLABLE(); + $m = new \Upper\PBCASE(); + $m = new \Upper\PBCATCH(); + $m = new \Upper\PBCLASS(); + $m = new \Upper\PBCLONE(); + $m = new \Upper\PBCONST(); + $m = new \Upper\PBCONTINUE(); + $m = new \Upper\PBDECLARE(); + $m = new \Upper\PBDEFAULT(); + $m = new \Upper\PBDIE(); + $m = new \Upper\PBDO(); + $m = new \Upper\PBECHO(); + $m = new \Upper\PBELSE(); + $m = new \Upper\PBELSEIF(); + $m = new \Upper\PBEMPTY(); + $m = new \Upper\PBENDDECLARE(); + $m = new \Upper\PBENDFOR(); + $m = new \Upper\PBENDFOREACH(); + $m = new \Upper\PBENDIF(); + $m = new \Upper\PBENDSWITCH(); + $m = new \Upper\PBENDWHILE(); + $m = new \Upper\PBEVAL(); + $m = new \Upper\PBEXIT(); + $m = new \Upper\PBEXTENDS(); + $m = new \Upper\PBFINAL(); + $m = new \Upper\PBFOR(); + $m = new \Upper\PBFOREACH(); + $m = new \Upper\PBFUNCTION(); + $m = new \Upper\PBGLOBAL(); + $m = new \Upper\PBGOTO(); + $m = new \Upper\PBIF(); + $m = new \Upper\PBIMPLEMENTS(); + $m = new \Upper\PBINCLUDE(); + $m = new \Upper\PBINCLUDE_ONCE(); + $m = new \Upper\PBINSTANCEOF(); + $m = new \Upper\PBINSTEADOF(); + $m = new \Upper\PBINTERFACE(); + $m = new \Upper\PBISSET(); + $m = new \Upper\PBLIST(); + $m = new \Upper\PBNAMESPACE(); + $m = new \Upper\PBNEW(); + $m = new \Upper\PBOR(); + $m = new \Upper\PBPRINT(); + $m = new \Upper\PBPRIVATE(); + $m = new \Upper\PBPROTECTED(); + $m = new \Upper\PBPUBLIC(); + $m = new \Upper\PBREQUIRE(); + $m = new \Upper\PBREQUIRE_ONCE(); + $m = new \Upper\PBRETURN(); + $m = new \Upper\PBSTATIC(); + $m = new \Upper\PBSWITCH(); + $m = new \Upper\PBTHROW(); + $m = new \Upper\PBTRAIT(); + $m = new \Upper\PBTRY(); + $m = new \Upper\PBUNSET(); + $m = new \Upper\PBUSE(); + $m = new \Upper\PBVAR(); + $m = new \Upper\PBWHILE(); + $m = new \Upper\PBXOR(); + $m = new \Upper\PBINT(); + $m = new \Upper\PBFLOAT(); + $m = new \Upper\PBBOOL(); + $m = new \Upper\PBSTRING(); + $m = new \Upper\PBTRUE(); + $m = new \Upper\PBFALSE(); + $m = new \Upper\PBNULL(); + $m = new \Upper\PBVOID(); + $m = new \Upper\PBITERABLE(); + + $m = new \Lower_enum\PBabstract(); + $m = new \Lower_enum\PBand(); + $m = new \Lower_enum\PBarray(); + $m = new \Lower_enum\PBas(); + $m = new \Lower_enum\PBbreak(); + $m = new \Lower_enum\PBcallable(); + $m = new \Lower_enum\PBcase(); + $m = new \Lower_enum\PBcatch(); + $m = new \Lower_enum\PBclass(); + $m = new \Lower_enum\PBclone(); + $m = new \Lower_enum\PBconst(); + $m = new \Lower_enum\PBcontinue(); + $m = new \Lower_enum\PBdeclare(); + $m = new \Lower_enum\PBdefault(); + $m = new \Lower_enum\PBdie(); + $m = new \Lower_enum\PBdo(); + $m = new \Lower_enum\PBecho(); + $m = new \Lower_enum\PBelse(); + $m = new \Lower_enum\PBelseif(); + $m = new \Lower_enum\PBempty(); + $m = new \Lower_enum\PBenddeclare(); + $m = new \Lower_enum\PBendfor(); + $m = new \Lower_enum\PBendforeach(); + $m = new \Lower_enum\PBendif(); + $m = new \Lower_enum\PBendswitch(); + $m = new \Lower_enum\PBendwhile(); + $m = new \Lower_enum\PBeval(); + $m = new \Lower_enum\PBexit(); + $m = new \Lower_enum\PBextends(); + $m = new \Lower_enum\PBfinal(); + $m = new \Lower_enum\PBfor(); + $m = new \Lower_enum\PBforeach(); + $m = new \Lower_enum\PBfunction(); + $m = new \Lower_enum\PBglobal(); + $m = new \Lower_enum\PBgoto(); + $m = new \Lower_enum\PBif(); + $m = new \Lower_enum\PBimplements(); + $m = new \Lower_enum\PBinclude(); + $m = new \Lower_enum\PBinclude_once(); + $m = new \Lower_enum\PBinstanceof(); + $m = new \Lower_enum\PBinsteadof(); + $m = new \Lower_enum\PBinterface(); + $m = new \Lower_enum\PBisset(); + $m = new \Lower_enum\PBlist(); + $m = new \Lower_enum\PBnamespace(); + $m = new \Lower_enum\PBnew(); + $m = new \Lower_enum\PBor(); + $m = new \Lower_enum\PBprint(); + $m = new \Lower_enum\PBprivate(); + $m = new \Lower_enum\PBprotected(); + $m = new \Lower_enum\PBpublic(); + $m = new \Lower_enum\PBrequire(); + $m = new \Lower_enum\PBrequire_once(); + $m = new \Lower_enum\PBreturn(); + $m = new \Lower_enum\PBstatic(); + $m = new \Lower_enum\PBswitch(); + $m = new \Lower_enum\PBthrow(); + $m = new \Lower_enum\PBtrait(); + $m = new \Lower_enum\PBtry(); + $m = new \Lower_enum\PBunset(); + $m = new \Lower_enum\PBuse(); + $m = new \Lower_enum\PBvar(); + $m = new \Lower_enum\PBwhile(); + $m = new \Lower_enum\PBxor(); + $m = new \Lower_enum\PBint(); + $m = new \Lower_enum\PBfloat(); + $m = new \Lower_enum\PBbool(); + $m = new \Lower_enum\PBstring(); + $m = new \Lower_enum\PBtrue(); + $m = new \Lower_enum\PBfalse(); + $m = new \Lower_enum\PBnull(); + $m = new \Lower_enum\PBvoid(); + $m = new \Lower_enum\PBiterable(); + + $m = new \Upper_enum\PBABSTRACT(); + $m = new \Upper_enum\PBAND(); + $m = new \Upper_enum\PBARRAY(); + $m = new \Upper_enum\PBAS(); + $m = new \Upper_enum\PBBREAK(); + $m = new \Upper_enum\PBCALLABLE(); + $m = new \Upper_enum\PBCASE(); + $m = new \Upper_enum\PBCATCH(); + $m = new \Upper_enum\PBCLASS(); + $m = new \Upper_enum\PBCLONE(); + $m = new \Upper_enum\PBCONST(); + $m = new \Upper_enum\PBCONTINUE(); + $m = new \Upper_enum\PBDECLARE(); + $m = new \Upper_enum\PBDEFAULT(); + $m = new \Upper_enum\PBDIE(); + $m = new \Upper_enum\PBDO(); + $m = new \Upper_enum\PBECHO(); + $m = new \Upper_enum\PBELSE(); + $m = new \Upper_enum\PBELSEIF(); + $m = new \Upper_enum\PBEMPTY(); + $m = new \Upper_enum\PBENDDECLARE(); + $m = new \Upper_enum\PBENDFOR(); + $m = new \Upper_enum\PBENDFOREACH(); + $m = new \Upper_enum\PBENDIF(); + $m = new \Upper_enum\PBENDSWITCH(); + $m = new \Upper_enum\PBENDWHILE(); + $m = new \Upper_enum\PBEVAL(); + $m = new \Upper_enum\PBEXIT(); + $m = new \Upper_enum\PBEXTENDS(); + $m = new \Upper_enum\PBFINAL(); + $m = new \Upper_enum\PBFOR(); + $m = new \Upper_enum\PBFOREACH(); + $m = new \Upper_enum\PBFUNCTION(); + $m = new \Upper_enum\PBGLOBAL(); + $m = new \Upper_enum\PBGOTO(); + $m = new \Upper_enum\PBIF(); + $m = new \Upper_enum\PBIMPLEMENTS(); + $m = new \Upper_enum\PBINCLUDE(); + $m = new \Upper_enum\PBINCLUDE_ONCE(); + $m = new \Upper_enum\PBINSTANCEOF(); + $m = new \Upper_enum\PBINSTEADOF(); + $m = new \Upper_enum\PBINTERFACE(); + $m = new \Upper_enum\PBISSET(); + $m = new \Upper_enum\PBLIST(); + $m = new \Upper_enum\PBNAMESPACE(); + $m = new \Upper_enum\PBNEW(); + $m = new \Upper_enum\PBOR(); + $m = new \Upper_enum\PBPRINT(); + $m = new \Upper_enum\PBPRIVATE(); + $m = new \Upper_enum\PBPROTECTED(); + $m = new \Upper_enum\PBPUBLIC(); + $m = new \Upper_enum\PBREQUIRE(); + $m = new \Upper_enum\PBREQUIRE_ONCE(); + $m = new \Upper_enum\PBRETURN(); + $m = new \Upper_enum\PBSTATIC(); + $m = new \Upper_enum\PBSWITCH(); + $m = new \Upper_enum\PBTHROW(); + $m = new \Upper_enum\PBTRAIT(); + $m = new \Upper_enum\PBTRY(); + $m = new \Upper_enum\PBUNSET(); + $m = new \Upper_enum\PBUSE(); + $m = new \Upper_enum\PBVAR(); + $m = new \Upper_enum\PBWHILE(); + $m = new \Upper_enum\PBXOR(); + $m = new \Upper_enum\PBINT(); + $m = new \Upper_enum\PBFLOAT(); + $m = new \Upper_enum\PBBOOL(); + $m = new \Upper_enum\PBSTRING(); + $m = new \Upper_enum\PBTRUE(); + $m = new \Upper_enum\PBFALSE(); + $m = new \Upper_enum\PBNULL(); + $m = new \Upper_enum\PBVOID(); + $m = new \Upper_enum\PBITERABLE(); + + $m = \Lower_enum_value\NotAllowed::PBabstract; + $m = \Lower_enum_value\NotAllowed::PBand; + $m = \Lower_enum_value\NotAllowed::PBarray; + $m = \Lower_enum_value\NotAllowed::PBas; + $m = \Lower_enum_value\NotAllowed::PBbreak; + $m = \Lower_enum_value\NotAllowed::PBcallable; + $m = \Lower_enum_value\NotAllowed::PBcase; + $m = \Lower_enum_value\NotAllowed::PBcatch; + $m = \Lower_enum_value\NotAllowed::PBclass; + $m = \Lower_enum_value\NotAllowed::PBclone; + $m = \Lower_enum_value\NotAllowed::PBconst; + $m = \Lower_enum_value\NotAllowed::PBcontinue; + $m = \Lower_enum_value\NotAllowed::PBdeclare; + $m = \Lower_enum_value\NotAllowed::PBdefault; + $m = \Lower_enum_value\NotAllowed::PBdie; + $m = \Lower_enum_value\NotAllowed::PBdo; + $m = \Lower_enum_value\NotAllowed::PBecho; + $m = \Lower_enum_value\NotAllowed::PBelse; + $m = \Lower_enum_value\NotAllowed::PBelseif; + $m = \Lower_enum_value\NotAllowed::PBempty; + $m = \Lower_enum_value\NotAllowed::PBenddeclare; + $m = \Lower_enum_value\NotAllowed::PBendfor; + $m = \Lower_enum_value\NotAllowed::PBendforeach; + $m = \Lower_enum_value\NotAllowed::PBendif; + $m = \Lower_enum_value\NotAllowed::PBendswitch; + $m = \Lower_enum_value\NotAllowed::PBendwhile; + $m = \Lower_enum_value\NotAllowed::PBeval; + $m = \Lower_enum_value\NotAllowed::PBexit; + $m = \Lower_enum_value\NotAllowed::PBextends; + $m = \Lower_enum_value\NotAllowed::PBfinal; + $m = \Lower_enum_value\NotAllowed::PBfor; + $m = \Lower_enum_value\NotAllowed::PBforeach; + $m = \Lower_enum_value\NotAllowed::PBfunction; + $m = \Lower_enum_value\NotAllowed::PBglobal; + $m = \Lower_enum_value\NotAllowed::PBgoto; + $m = \Lower_enum_value\NotAllowed::PBif; + $m = \Lower_enum_value\NotAllowed::PBimplements; + $m = \Lower_enum_value\NotAllowed::PBinclude; + $m = \Lower_enum_value\NotAllowed::PBinclude_once; + $m = \Lower_enum_value\NotAllowed::PBinstanceof; + $m = \Lower_enum_value\NotAllowed::PBinsteadof; + $m = \Lower_enum_value\NotAllowed::PBinterface; + $m = \Lower_enum_value\NotAllowed::PBisset; + $m = \Lower_enum_value\NotAllowed::PBlist; + $m = \Lower_enum_value\NotAllowed::PBnamespace; + $m = \Lower_enum_value\NotAllowed::PBnew; + $m = \Lower_enum_value\NotAllowed::PBor; + $m = \Lower_enum_value\NotAllowed::PBprint; + $m = \Lower_enum_value\NotAllowed::PBprivate; + $m = \Lower_enum_value\NotAllowed::PBprotected; + $m = \Lower_enum_value\NotAllowed::PBpublic; + $m = \Lower_enum_value\NotAllowed::PBrequire; + $m = \Lower_enum_value\NotAllowed::PBrequire_once; + $m = \Lower_enum_value\NotAllowed::PBreturn; + $m = \Lower_enum_value\NotAllowed::PBstatic; + $m = \Lower_enum_value\NotAllowed::PBswitch; + $m = \Lower_enum_value\NotAllowed::PBthrow; + $m = \Lower_enum_value\NotAllowed::PBtrait; + $m = \Lower_enum_value\NotAllowed::PBtry; + $m = \Lower_enum_value\NotAllowed::PBunset; + $m = \Lower_enum_value\NotAllowed::PBuse; + $m = \Lower_enum_value\NotAllowed::PBvar; + $m = \Lower_enum_value\NotAllowed::PBwhile; + $m = \Lower_enum_value\NotAllowed::PBxor; + $m = \Lower_enum_value\NotAllowed::int; + $m = \Lower_enum_value\NotAllowed::float; + $m = \Lower_enum_value\NotAllowed::bool; + $m = \Lower_enum_value\NotAllowed::string; + $m = \Lower_enum_value\NotAllowed::true; + $m = \Lower_enum_value\NotAllowed::false; + $m = \Lower_enum_value\NotAllowed::null; + $m = \Lower_enum_value\NotAllowed::void; + $m = \Lower_enum_value\NotAllowed::iterable; + + $m = \Upper_enum_value\NotAllowed::PBABSTRACT; + $m = \Upper_enum_value\NotAllowed::PBAND; + $m = \Upper_enum_value\NotAllowed::PBARRAY; + $m = \Upper_enum_value\NotAllowed::PBAS; + $m = \Upper_enum_value\NotAllowed::PBBREAK; + $m = \Upper_enum_value\NotAllowed::PBCALLABLE; + $m = \Upper_enum_value\NotAllowed::PBCASE; + $m = \Upper_enum_value\NotAllowed::PBCATCH; + $m = \Upper_enum_value\NotAllowed::PBCLASS; + $m = \Upper_enum_value\NotAllowed::PBCLONE; + $m = \Upper_enum_value\NotAllowed::PBCONST; + $m = \Upper_enum_value\NotAllowed::PBCONTINUE; + $m = \Upper_enum_value\NotAllowed::PBDECLARE; + $m = \Upper_enum_value\NotAllowed::PBDEFAULT; + $m = \Upper_enum_value\NotAllowed::PBDIE; + $m = \Upper_enum_value\NotAllowed::PBDO; + $m = \Upper_enum_value\NotAllowed::PBECHO; + $m = \Upper_enum_value\NotAllowed::PBELSE; + $m = \Upper_enum_value\NotAllowed::PBELSEIF; + $m = \Upper_enum_value\NotAllowed::PBEMPTY; + $m = \Upper_enum_value\NotAllowed::PBENDDECLARE; + $m = \Upper_enum_value\NotAllowed::PBENDFOR; + $m = \Upper_enum_value\NotAllowed::PBENDFOREACH; + $m = \Upper_enum_value\NotAllowed::PBENDIF; + $m = \Upper_enum_value\NotAllowed::PBENDSWITCH; + $m = \Upper_enum_value\NotAllowed::PBENDWHILE; + $m = \Upper_enum_value\NotAllowed::PBEVAL; + $m = \Upper_enum_value\NotAllowed::PBEXIT; + $m = \Upper_enum_value\NotAllowed::PBEXTENDS; + $m = \Upper_enum_value\NotAllowed::PBFINAL; + $m = \Upper_enum_value\NotAllowed::PBFOR; + $m = \Upper_enum_value\NotAllowed::PBFOREACH; + $m = \Upper_enum_value\NotAllowed::PBFUNCTION; + $m = \Upper_enum_value\NotAllowed::PBGLOBAL; + $m = \Upper_enum_value\NotAllowed::PBGOTO; + $m = \Upper_enum_value\NotAllowed::PBIF; + $m = \Upper_enum_value\NotAllowed::PBIMPLEMENTS; + $m = \Upper_enum_value\NotAllowed::PBINCLUDE; + $m = \Upper_enum_value\NotAllowed::PBINCLUDE_ONCE; + $m = \Upper_enum_value\NotAllowed::PBINSTANCEOF; + $m = \Upper_enum_value\NotAllowed::PBINSTEADOF; + $m = \Upper_enum_value\NotAllowed::PBINTERFACE; + $m = \Upper_enum_value\NotAllowed::PBISSET; + $m = \Upper_enum_value\NotAllowed::PBLIST; + $m = \Upper_enum_value\NotAllowed::PBNAMESPACE; + $m = \Upper_enum_value\NotAllowed::PBNEW; + $m = \Upper_enum_value\NotAllowed::PBOR; + $m = \Upper_enum_value\NotAllowed::PBPRINT; + $m = \Upper_enum_value\NotAllowed::PBPRIVATE; + $m = \Upper_enum_value\NotAllowed::PBPROTECTED; + $m = \Upper_enum_value\NotAllowed::PBPUBLIC; + $m = \Upper_enum_value\NotAllowed::PBREQUIRE; + $m = \Upper_enum_value\NotAllowed::PBREQUIRE_ONCE; + $m = \Upper_enum_value\NotAllowed::PBRETURN; + $m = \Upper_enum_value\NotAllowed::PBSTATIC; + $m = \Upper_enum_value\NotAllowed::PBSWITCH; + $m = \Upper_enum_value\NotAllowed::PBTHROW; + $m = \Upper_enum_value\NotAllowed::PBTRAIT; + $m = \Upper_enum_value\NotAllowed::PBTRY; + $m = \Upper_enum_value\NotAllowed::PBUNSET; + $m = \Upper_enum_value\NotAllowed::PBUSE; + $m = \Upper_enum_value\NotAllowed::PBVAR; + $m = \Upper_enum_value\NotAllowed::PBWHILE; + $m = \Upper_enum_value\NotAllowed::PBXOR; + $m = \Upper_enum_value\NotAllowed::INT; + $m = \Upper_enum_value\NotAllowed::FLOAT; + $m = \Upper_enum_value\NotAllowed::BOOL; + $m = \Upper_enum_value\NotAllowed::STRING; + $m = \Upper_enum_value\NotAllowed::TRUE; + $m = \Upper_enum_value\NotAllowed::FALSE; + $m = \Upper_enum_value\NotAllowed::NULL; + $m = \Upper_enum_value\NotAllowed::VOID; + $m = \Upper_enum_value\NotAllowed::ITERABLE; } ######################################################### diff --git a/php/tests/proto/test_reserved_enum_lower.proto b/php/tests/proto/test_reserved_enum_lower.proto new file mode 100644 index 00000000..d2daeaff --- /dev/null +++ b/php/tests/proto/test_reserved_enum_lower.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; + +package lower_enum; + +enum abstract { ZERO1 = 0; } +enum and { ZERO2 = 0; } +enum array { ZERO3 = 0; } +enum as { ZERO4 = 0; } +enum break { ZERO5 = 0; } +enum callable { ZERO6 = 0; } +enum case { ZERO7 = 0; } +enum catch { ZERO8 = 0; } +enum class { ZERO9 = 0; } +enum clone { ZERO10 = 0; } +enum const { ZERO11 = 0; } +enum continue { ZERO12 = 0; } +enum declare { ZERO13 = 0; } +enum default { ZERO14 = 0; } +enum die { ZERO15 = 0; } +enum do { ZERO16 = 0; } +enum echo { ZERO17 = 0; } +enum else { ZERO18 = 0; } +enum elseif { ZERO19 = 0; } +enum empty { ZERO20 = 0; } +enum enddeclare { ZERO21 = 0; } +enum endfor { ZERO22 = 0; } +enum endforeach { ZERO23 = 0; } +enum endif { ZERO24 = 0; } +enum endswitch { ZERO25 = 0; } +enum endwhile { ZERO26 = 0; } +enum eval { ZERO27 = 0; } +enum exit { ZERO28 = 0; } +enum extends { ZERO29 = 0; } +enum final { ZERO30 = 0; } +enum for { ZERO31 = 0; } +enum foreach { ZERO32 = 0; } +enum function { ZERO33 = 0; } +enum global { ZERO34 = 0; } +enum goto { ZERO35 = 0; } +enum if { ZERO36 = 0; } +enum implements { ZERO37 = 0; } +enum include { ZERO38 = 0; } +enum include_once { ZERO39 = 0; } +enum instanceof { ZERO40 = 0; } +enum insteadof { ZERO41 = 0; } +enum interface { ZERO42 = 0; } +enum isset { ZERO43 = 0; } +enum list { ZERO44 = 0; } +enum namespace { ZERO45 = 0; } +enum new { ZERO46 = 0; } +enum or { ZERO47 = 0; } +enum print { ZERO48 = 0; } +enum private { ZERO49 = 0; } +enum protected { ZERO50 = 0; } +enum public { ZERO51 = 0; } +enum require { ZERO52 = 0; } +enum require_once { ZERO53 = 0; } +enum return { ZERO54 = 0; } +enum static { ZERO55 = 0; } +enum switch { ZERO56 = 0; } +enum throw { ZERO57 = 0; } +enum trait { ZERO58 = 0; } +enum try { ZERO59 = 0; } +enum unset { ZERO60 = 0; } +enum use { ZERO61 = 0; } +enum var { ZERO62 = 0; } +enum while { ZERO63 = 0; } +enum xor { ZERO64 = 0; } +enum int { ZERO65 = 0; } +enum float { ZERO66 = 0; } +enum bool { ZERO67 = 0; } +enum string { ZERO68 = 0; } +enum true { ZERO69 = 0; } +enum false { ZERO70 = 0; } +enum null { ZERO71 = 0; } +enum void { ZERO72 = 0; } +enum iterable { ZERO73 = 0; } diff --git a/php/tests/proto/test_reserved_enum_upper.proto b/php/tests/proto/test_reserved_enum_upper.proto new file mode 100644 index 00000000..a396fea3 --- /dev/null +++ b/php/tests/proto/test_reserved_enum_upper.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; + +package upper_enum; + +enum ABSTRACT { ZERO1 = 0; } +enum AND { ZERO2 = 0; } +enum ARRAY { ZERO3 = 0; } +enum AS { ZERO4 = 0; } +enum BREAK { ZERO5 = 0; } +enum CALLABLE { ZERO6 = 0; } +enum CASE { ZERO7 = 0; } +enum CATCH { ZERO8 = 0; } +enum CLASS { ZERO9 = 0; } +enum CLONE { ZERO10 = 0; } +enum CONST { ZERO11 = 0; } +enum CONTINUE { ZERO12 = 0; } +enum DECLARE { ZERO13 = 0; } +enum DEFAULT { ZERO14 = 0; } +enum DIE { ZERO15 = 0; } +enum DO { ZERO16 = 0; } +enum ECHO { ZERO17 = 0; } +enum ELSE { ZERO18 = 0; } +enum ELSEIF { ZERO19 = 0; } +enum EMPTY { ZERO20 = 0; } +enum ENDDECLARE { ZERO21 = 0; } +enum ENDFOR { ZERO22 = 0; } +enum ENDFOREACH { ZERO23 = 0; } +enum ENDIF { ZERO24 = 0; } +enum ENDSWITCH { ZERO25 = 0; } +enum ENDWHILE { ZERO26 = 0; } +enum EVAL { ZERO27 = 0; } +enum EXIT { ZERO28 = 0; } +enum EXTENDS { ZERO29 = 0; } +enum FINAL { ZERO30 = 0; } +enum FOR { ZERO31 = 0; } +enum FOREACH { ZERO32 = 0; } +enum FUNCTION { ZERO33 = 0; } +enum GLOBAL { ZERO34 = 0; } +enum GOTO { ZERO35 = 0; } +enum IF { ZERO36 = 0; } +enum IMPLEMENTS { ZERO37 = 0; } +enum INCLUDE { ZERO38 = 0; } +enum INCLUDE_ONCE { ZERO39 = 0; } +enum INSTANCEOF { ZERO40 = 0; } +enum INSTEADOF { ZERO41 = 0; } +enum INTERFACE { ZERO42 = 0; } +enum ISSET { ZERO43 = 0; } +enum LIST { ZERO44 = 0; } +enum NAMESPACE { ZERO45 = 0; } +enum NEW { ZERO46 = 0; } +enum OR { ZERO47 = 0; } +enum PRINT { ZERO48 = 0; } +enum PRIVATE { ZERO49 = 0; } +enum PROTECTED { ZERO50 = 0; } +enum PUBLIC { ZERO51 = 0; } +enum REQUIRE { ZERO52 = 0; } +enum REQUIRE_ONCE { ZERO53 = 0; } +enum RETURN { ZERO54 = 0; } +enum STATIC { ZERO55 = 0; } +enum SWITCH { ZERO56 = 0; } +enum THROW { ZERO57 = 0; } +enum TRAIT { ZERO58 = 0; } +enum TRY { ZERO59 = 0; } +enum UNSET { ZERO60 = 0; } +enum USE { ZERO61 = 0; } +enum VAR { ZERO62 = 0; } +enum WHILE { ZERO63 = 0; } +enum XOR { ZERO64 = 0; } +enum INT { ZERO65 = 0; } +enum FLOAT { ZERO66 = 0; } +enum BOOL { ZERO67 = 0; } +enum STRING { ZERO68 = 0; } +enum TRUE { ZERO69 = 0; } +enum FALSE { ZERO70 = 0; } +enum NULL { ZERO71 = 0; } +enum VOID { ZERO72 = 0; } +enum ITERABLE { ZERO73 = 0; } diff --git a/php/tests/proto/test_reserved_enum_value_lower.proto b/php/tests/proto/test_reserved_enum_value_lower.proto new file mode 100644 index 00000000..96da319e --- /dev/null +++ b/php/tests/proto/test_reserved_enum_value_lower.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; + +package lower_enum_value; + +enum NotAllowed { + abstract = 0; + and = 1; + array = 2; + as = 3; + break = 4; + callable = 5; + case = 6; + catch = 7; + class = 8; + clone = 9; + const = 10; + continue = 11; + declare = 12; + default = 13; + die = 14; + do = 15; + echo = 16; + else = 17; + elseif = 18; + empty = 19; + enddeclare = 20; + endfor = 21; + endforeach = 22; + endif = 23; + endswitch = 24; + endwhile = 25; + eval = 26; + exit = 27; + extends = 28; + final = 29; + for = 30; + foreach = 31; + function = 32; + global = 33; + goto = 34; + if = 35; + implements = 36; + include = 37; + include_once = 38; + instanceof = 39; + insteadof = 40; + interface = 41; + isset = 42; + list = 43; + namespace = 44; + new = 45; + or = 46; + print = 47; + private = 48; + protected = 49; + public = 50; + require = 51; + require_once = 52; + return = 53; + static = 54; + switch = 55; + throw = 56; + trait = 57; + try = 58; + unset = 59; + use = 60; + var = 61; + while = 62; + xor = 63; + int = 64; + float = 65; + bool = 66; + string = 67; + true = 68; + false = 69; + null = 70; + void = 71; + iterable = 72; +} diff --git a/php/tests/proto/test_reserved_enum_value_upper.proto b/php/tests/proto/test_reserved_enum_value_upper.proto new file mode 100644 index 00000000..b026a858 --- /dev/null +++ b/php/tests/proto/test_reserved_enum_value_upper.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; + +package upper_enum_value; + +enum NotAllowed { + ABSTRACT = 0; + AND = 1; + ARRAY = 2; + AS = 3; + BREAK = 4; + CALLABLE = 5; + CASE = 6; + CATCH = 7; + CLASS = 8; + CLONE = 9; + CONST = 10; + CONTINUE = 11; + DECLARE = 12; + DEFAULT = 13; + DIE = 14; + DO = 15; + ECHO = 16; + ELSE = 17; + ELSEIF = 18; + EMPTY = 19; + ENDDECLARE = 20; + ENDFOR = 21; + ENDFOREACH = 22; + ENDIF = 23; + ENDSWITCH = 24; + ENDWHILE = 25; + EVAL = 26; + EXIT = 27; + EXTENDS = 28; + FINAL = 29; + FOR = 30; + FOREACH = 31; + FUNCTION = 32; + GLOBAL = 33; + GOTO = 34; + IF = 35; + IMPLEMENTS = 36; + INCLUDE = 37; + INCLUDE_ONCE = 38; + INSTANCEOF = 39; + INSTEADOF = 40; + INTERFACE = 41; + ISSET = 42; + LIST = 43; + NAMESPACE = 44; + NEW = 45; + OR = 46; + PRINT = 47; + PRIVATE = 48; + PROTECTED = 49; + PUBLIC = 50; + REQUIRE = 51; + REQUIRE_ONCE = 52; + RETURN = 53; + STATIC = 54; + SWITCH = 55; + THROW = 56; + TRAIT = 57; + TRY = 58; + UNSET = 59; + USE = 60; + VAR = 61; + WHILE = 62; + XOR = 63; + INT = 64; + FLOAT = 65; + BOOL = 66; + STRING = 67; + TRUE = 68; + FALSE = 69; + NULL = 70; + VOID = 71; + ITERABLE = 72; +} diff --git a/php/tests/proto/test_reserved_message_lower.proto b/php/tests/proto/test_reserved_message_lower.proto new file mode 100644 index 00000000..ed120808 --- /dev/null +++ b/php/tests/proto/test_reserved_message_lower.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; + +package lower; + +message abstract {} +message and {} +message array {} +message as {} +message break {} +message callable {} +message case {} +message catch {} +message class {} +message clone {} +message const {} +message continue {} +message declare {} +message default {} +message die {} +message do {} +message echo {} +message else {} +message elseif {} +message empty {} +message enddeclare {} +message endfor {} +message endforeach {} +message endif {} +message endswitch {} +message endwhile {} +message eval {} +message exit {} +message extends {} +message final {} +message for {} +message foreach {} +message function {} +message global {} +message goto {} +message if {} +message implements {} +message include {} +message include_once {} +message instanceof {} +message insteadof {} +message interface {} +message isset {} +message list {} +message namespace {} +message new {} +message or {} +message print {} +message private {} +message protected {} +message public {} +message require {} +message require_once {} +message return {} +message static {} +message switch {} +message throw {} +message trait {} +message try {} +message unset {} +message use {} +message var {} +message while {} +message xor {} +message int {} +message float {} +message bool {} +message string {} +message true {} +message false {} +message null {} +message void {} +message iterable {} diff --git a/php/tests/proto/test_reserved_message_upper.proto b/php/tests/proto/test_reserved_message_upper.proto new file mode 100644 index 00000000..2917fd11 --- /dev/null +++ b/php/tests/proto/test_reserved_message_upper.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; + +package upper; + +message ABSTRACT {} +message AND {} +message ARRAY {} +message AS {} +message BREAK {} +message CALLABLE {} +message CASE {} +message CATCH {} +message CLASS {} +message CLONE {} +message CONST {} +message CONTINUE {} +message DECLARE {} +message DEFAULT {} +message DIE {} +message DO {} +message ECHO {} +message ELSE {} +message ELSEIF {} +message EMPTY {} +message ENDDECLARE {} +message ENDFOR {} +message ENDFOREACH {} +message ENDIF {} +message ENDSWITCH {} +message ENDWHILE {} +message EVAL {} +message EXIT {} +message EXTENDS {} +message FINAL {} +message FOR {} +message FOREACH {} +message FUNCTION {} +message GLOBAL {} +message GOTO {} +message IF {} +message IMPLEMENTS {} +message INCLUDE {} +message INCLUDE_ONCE {} +message INSTANCEOF {} +message INSTEADOF {} +message INTERFACE {} +message ISSET {} +message LIST {} +message NAMESPACE {} +message NEW {} +message OR {} +message PRINT {} +message PRIVATE {} +message PROTECTED {} +message PUBLIC {} +message REQUIRE {} +message REQUIRE_ONCE {} +message RETURN {} +message STATIC {} +message SWITCH {} +message THROW {} +message TRAIT {} +message TRY {} +message UNSET {} +message USE {} +message VAR {} +message WHILE {} +message XOR {} +message INT {} +message FLOAT {} +message BOOL {} +message STRING {} +message TRUE {} +message FALSE {} +message NULL {} +message VOID {} +message ITERABLE {} |