@@ -675,6 +675,22 @@ static inheritance_status zend_is_intersection_subtype_of_type(
675
675
return early_exit_status == INHERITANCE_ERROR ? INHERITANCE_SUCCESS : INHERITANCE_ERROR ;
676
676
}
677
677
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
+
678
694
ZEND_API inheritance_status zend_perform_covariant_type_check (
679
695
zend_class_entry * fe_scope , const zend_type * fe_type_ptr ,
680
696
zend_class_entry * proto_scope , const zend_type * proto_type_ptr )
@@ -690,6 +706,11 @@ ZEND_API inheritance_status zend_perform_covariant_type_check(
690
706
return INHERITANCE_SUCCESS ;
691
707
}
692
708
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
+
693
714
/* Builtin types may be removed, but not added */
694
715
uint32_t fe_type_mask = ZEND_TYPE_PURE_MASK (fe_type );
695
716
uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK (proto_type );
0 commit comments