diff --git a/Library/ClassMethod.php b/Library/ClassMethod.php index 9b3237b247..31801884b0 100644 --- a/Library/ClassMethod.php +++ b/Library/ClassMethod.php @@ -511,6 +511,7 @@ public function getVisibility() * Returns the C-modifier flags * * @return string + * @throws Exception */ public function getModifiers() { @@ -535,6 +536,9 @@ public function getModifiers() case 'abstract': $modifiers['ZEND_ACC_ABSTRACT'] = $visibility; break; + case 'deprecated': + $modifiers['ZEND_ACC_DEPRECATED'] = $visibility; + break; case 'inline': break; case 'scoped': diff --git a/parser/base.c b/parser/base.c index 978312827e..99af500fd7 100644 --- a/parser/base.c +++ b/parser/base.c @@ -206,6 +206,9 @@ int xx_parse_program(char *program, unsigned int program_length, char *file_path case XX_T_INLINE: xx_(xx_parser, XX_INLINE, NULL, parser_status); break; + case XX_T_DEPRECATED: + xx_(xx_parser, XX_DEPRECATED, NULL, parser_status); + break; case XX_T_FINAL: xx_(xx_parser, XX_FINAL, NULL, parser_status); break; diff --git a/parser/parser.h b/parser/parser.h index ac5012b231..7b127db67f 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -60,58 +60,59 @@ #define XX_FUNCTION 60 #define XX_PARENTHESES_OPEN 61 #define XX_INLINE 62 -#define XX_VOID 63 -#define XX_NULL 64 -#define XX_THIS 65 -#define XX_SBRACKET_CLOSE 66 -#define XX_TYPE_INTEGER 67 -#define XX_TYPE_UINTEGER 68 -#define XX_TYPE_LONG 69 -#define XX_TYPE_ULONG 70 -#define XX_TYPE_CHAR 71 -#define XX_TYPE_UCHAR 72 -#define XX_TYPE_DOUBLE 73 -#define XX_TYPE_BOOL 74 -#define XX_TYPE_STRING 75 -#define XX_TYPE_ARRAY 76 -#define XX_TYPE_VAR 77 -#define XX_TYPE_CALLABLE 78 -#define XX_TYPE_RESOURCE 79 -#define XX_TYPE_OBJECT 80 -#define XX_BREAK 81 -#define XX_CONTINUE 82 -#define XX_IF 83 -#define XX_ELSE 84 -#define XX_SWITCH 85 -#define XX_CASE 86 -#define XX_COLON 87 -#define XX_DEFAULT 88 -#define XX_LOOP 89 -#define XX_WHILE 90 -#define XX_DO 91 -#define XX_TRY 92 -#define XX_CATCH 93 -#define XX_FOR 94 -#define XX_IN 95 -#define XX_REVERSE 96 -#define XX_LET 97 -#define XX_ADDASSIGN 98 -#define XX_SUBASSIGN 99 -#define XX_MULASSIGN 100 -#define XX_DIVASSIGN 101 -#define XX_CONCATASSIGN 102 -#define XX_MODASSIGN 103 -#define XX_STRING 104 -#define XX_DOUBLECOLON 105 -#define XX_INCR 106 -#define XX_DECR 107 -#define XX_ECHO 108 -#define XX_RETURN 109 -#define XX_UNSET 110 -#define XX_THROW 111 -#define XX_INTEGER 112 -#define XX_CHAR 113 -#define XX_DOUBLE 114 -#define XX_TRUE 115 -#define XX_FALSE 116 -#define XX_CBLOCK 117 +#define XX_DEPRECATED 63 +#define XX_VOID 64 +#define XX_NULL 65 +#define XX_THIS 66 +#define XX_SBRACKET_CLOSE 67 +#define XX_TYPE_INTEGER 68 +#define XX_TYPE_UINTEGER 69 +#define XX_TYPE_LONG 70 +#define XX_TYPE_ULONG 71 +#define XX_TYPE_CHAR 72 +#define XX_TYPE_UCHAR 73 +#define XX_TYPE_DOUBLE 74 +#define XX_TYPE_BOOL 75 +#define XX_TYPE_STRING 76 +#define XX_TYPE_ARRAY 77 +#define XX_TYPE_VAR 78 +#define XX_TYPE_CALLABLE 79 +#define XX_TYPE_RESOURCE 80 +#define XX_TYPE_OBJECT 81 +#define XX_BREAK 82 +#define XX_CONTINUE 83 +#define XX_IF 84 +#define XX_ELSE 85 +#define XX_SWITCH 86 +#define XX_CASE 87 +#define XX_COLON 88 +#define XX_DEFAULT 89 +#define XX_LOOP 90 +#define XX_WHILE 91 +#define XX_DO 92 +#define XX_TRY 93 +#define XX_CATCH 94 +#define XX_FOR 95 +#define XX_IN 96 +#define XX_REVERSE 97 +#define XX_LET 98 +#define XX_ADDASSIGN 99 +#define XX_SUBASSIGN 100 +#define XX_MULASSIGN 101 +#define XX_DIVASSIGN 102 +#define XX_CONCATASSIGN 103 +#define XX_MODASSIGN 104 +#define XX_STRING 105 +#define XX_DOUBLECOLON 106 +#define XX_INCR 107 +#define XX_DECR 108 +#define XX_ECHO 109 +#define XX_RETURN 110 +#define XX_UNSET 111 +#define XX_THROW 112 +#define XX_INTEGER 113 +#define XX_CHAR 114 +#define XX_DOUBLE 115 +#define XX_TRUE 116 +#define XX_FALSE 117 +#define XX_CBLOCK 118 diff --git a/parser/parser.lemon b/parser/parser.lemon index 35c74b8b1b..730b355cf1 100644 --- a/parser/parser.lemon +++ b/parser/parser.lemon @@ -1635,6 +1635,10 @@ xx_visibility(R) ::= INLINE . { R = json_object_new_string("inline"); } +xx_visibility(R) ::= DEPRECATED . { + R = json_object_new_string("deprecated"); +} + xx_visibility(R) ::= ABSTRACT . { R = json_object_new_string("abstract"); } diff --git a/parser/scanner.h b/parser/scanner.h index 5c24f4c8b3..4654976aee 100644 --- a/parser/scanner.h +++ b/parser/scanner.h @@ -100,6 +100,7 @@ #define XX_T_AS 396 #define XX_T_TRY 397 #define XX_T_CATCH 398 +#define XX_T_DEPRECATED 399 /* Operators */ #define XX_T_AT '@' diff --git a/parser/scanner.re b/parser/scanner.re index 30126f157f..da2c960b85 100644 --- a/parser/scanner.re +++ b/parser/scanner.re @@ -153,6 +153,12 @@ int xx_get_token(xx_scanner_state *s, xx_scanner_token *token) { return 0; } + 'deprecated' { + s->active_char += sizeof("deprecated")-1; + token->opcode = XX_T_DEPRECATED; + return 0; + } + 'final' { s->active_char += sizeof("final")-1; token->opcode = XX_T_FINAL;