+static void zend_compile_collection_key_type(zend_class_entry *ce, zend_ast *collection_key_type_ast)
+{
+ ZEND_ASSERT(ce->ce_flags & ZEND_ACC_COLLECTION);
+ zend_type type = zend_compile_typename(collection_key_type_ast, 0);
+ uint32_t type_mask = ZEND_TYPE_PURE_MASK(type);
+ if (ZEND_TYPE_IS_COMPLEX(type) || (type_mask != MAY_BE_LONG && type_mask != MAY_BE_STRING)) {
+ zend_string *type_string = zend_type_to_string(type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Collection key type must be int or string, %s given",
+ ZSTR_VAL(type_string));
+ }
+ if (type_mask == MAY_BE_LONG) {
+ ce->collection_key_type = IS_LONG;
+ } else {
+ ZEND_ASSERT(type_mask == MAY_BE_STRING);
+ ce->collection_key_type = IS_STRING;
+ }
+ zend_type_release(type, 0);
+}
+static void zend_compile_collection_item_type(zend_class_entry *ce, zend_ast *collection_item_type_ast)
+{
+ ZEND_ASSERT(ce->ce_flags & ZEND_ACC_COLLECTION);
+ zend_type type = zend_compile_typename(collection_item_type_ast, 0);
+
+ if (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_VOID|MAY_BE_NEVER|MAY_BE_CALLABLE)) {
+ zend_string *str = zend_type_to_string(type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Collection item type cannot have type %s", ZSTR_VAL(str));
+ }
+
+ ce->collection_item_type = type;
+}
+
static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel) /* {{{ */