@@ -407,8 +407,8 @@ static inheritance_status zend_perform_intersection_covariant_class_type_check(
407
407
bool have_unresolved = false;
408
408
zend_type * single_type ;
409
409
410
- /* Traverse the list of child types and check if it is either a subtype
411
- * of one of the parent types OR is not in the parent type list */
410
+ /* Traverse the list of child types and check that at least one is
411
+ * a subtype of the parent type being checked */
412
412
ZEND_TYPE_FOREACH (fe_type , single_type ) {
413
413
zend_class_entry * fe_ce ;
414
414
zend_string * fe_class_name = NULL ;
@@ -427,7 +427,7 @@ static inheritance_status zend_perform_intersection_covariant_class_type_check(
427
427
fe_ce = ZEND_TYPE_CE (* single_type );
428
428
} else {
429
429
/* standard type */
430
- ZEND_ASSERT ( 0 && "This shouldn't happen yet" );
430
+ ZEND_UNREACHABLE ( );
431
431
continue ;
432
432
}
433
433
@@ -542,7 +542,7 @@ static inheritance_status zend_is_single_type_subtype_intersection(
542
542
proto_ce = ZEND_TYPE_CE (* single_type );
543
543
} else {
544
544
/* standard type cannot be part a subtype of an intersection type */
545
- ZEND_ASSERT ( 0 && "This shouldn't happen yet" );
545
+ ZEND_UNREACHABLE ( );
546
546
continue ;
547
547
}
548
548
@@ -612,7 +612,7 @@ static inheritance_status zend_perform_covariant_type_check(
612
612
bool all_success = true;
613
613
614
614
/* If the child type is an intersection type then we need to loop over
615
- * the parents firstFor intersection types loop over the parent types first
615
+ * the parents first. For intersection types, loop over the parent types first
616
616
* as the child can add types, however none of them can be a supertype of
617
617
* a parent type. */
618
618
if (ZEND_TYPE_IS_INTERSECTION (fe_type )) {
@@ -629,7 +629,7 @@ static inheritance_status zend_perform_covariant_type_check(
629
629
proto_class_name = proto_ce -> name ;
630
630
} else {
631
631
/* standard type */
632
- ZEND_ASSERT ( 0 && "This shouldn't happen yet" );
632
+ ZEND_UNREACHABLE ( );
633
633
continue ;
634
634
}
635
635
@@ -698,7 +698,7 @@ static inheritance_status zend_perform_covariant_type_check(
698
698
proto_class_name = proto_ce -> name ;
699
699
} else {
700
700
/* standard type */
701
- ZEND_ASSERT ( 0 && "This shouldn't happen yet" );
701
+ ZEND_UNREACHABLE ( );
702
702
continue ;
703
703
}
704
704
0 commit comments