@@ -675,6 +675,22 @@ static inheritance_status zend_is_intersection_subtype_of_type(
675675 return early_exit_status == INHERITANCE_ERROR ? INHERITANCE_SUCCESS : INHERITANCE_ERROR ;
676676}
677677
678+ static inheritance_status zend_is_type_subtype_of_associated_type (
679+ zend_class_entry * concrete_scope ,
680+ const zend_type * concrete_type_ptr ,
681+ const zend_type * associated_type_ptr ,
682+ HashTable * associated_types
683+ ) {
684+ const zend_type associated_type = * associated_type_ptr ;
685+ const zend_type concrete_type = * concrete_type_ptr ;
686+
687+ ZEND_ASSERT (ZEND_TYPE_HAS_NAME (associated_type ));
688+
689+ zend_string * associated_type_name = ZEND_TYPE_NAME (associated_type );
690+
691+ return INHERITANCE_ERROR ;
692+ }
693+
678694ZEND_API inheritance_status zend_perform_covariant_type_check (
679695 zend_class_entry * fe_scope , const zend_type * fe_type_ptr ,
680696 zend_class_entry * proto_scope , const zend_type * proto_type_ptr )
@@ -690,6 +706,11 @@ ZEND_API inheritance_status zend_perform_covariant_type_check(
690706 return INHERITANCE_SUCCESS ;
691707 }
692708
709+ if (ZEND_TYPE_IS_ASSOCIATED (proto_type )) {
710+ return zend_is_type_subtype_of_associated_type (
711+ fe_scope , fe_type_ptr , proto_type_ptr , proto_scope -> associated_types );
712+ }
713+
693714 /* Builtin types may be removed, but not added */
694715 uint32_t fe_type_mask = ZEND_TYPE_PURE_MASK (fe_type );
695716 uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK (proto_type );
0 commit comments