Zend/zend_language_parser.y


%type <ast> enum_declaration_statement enum_backing_type enum_case enum_case_expr


enum_declaration_statement:
  T_ENUM { $<num>$ = CG(zend_lineno); }
  T_STRING enum_backing_type implements_list backup_doc_comment '{' class_statement_list '}'
    { $$ = zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_ENUM|ZEND_ACC_FINAL, $<num>2, $6, zend_ast_get_str($3), NULL, $5, $8, NULL, $4); }
;
Add:


%type <ast> collection_declaration_statement collection_type


collection_declaration_statement:
  T_COLLECTION { $<num>$ = CG(zend_lineno); }
  T_STRING '(' collection_type T_DOUBLE_ARROW collection_type ')' backup_doc_comment '{' class_statement_list '}'
    { $$ = zend_ast_create_decl(ZEND_AST_CLASS, ZEND_ACC_COLLECTION|ZEND_ACC_FINAL, $<num>2, $9, zend_ast_get_str($3), NULL, NULL, $11, $5, $7); }
;

collection_type:
  type_expr { $$ = $1; }


    |       enum_declaration_statement          { $$ = $1; }
    |       collection_declaration_statement    { $$ = $1; }
Zend/zend_compile.h


/* Special class types                                    |     |     |     */

#define ZEND_ACC_ENUM                    (1 << 28) /*  X  |     |     |     */
#define ZEND_ACC_COLLECTION              (1 << 30) /*  X  |     |     |     */