Skip to content

Commit 63c1bb3

Browse files
committed
More variance
1 parent 77c99fe commit 63c1bb3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Zend/zend_inheritance.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,28 @@ static inheritance_status zend_is_class_subtype_of_type(
463463
* class is the subtype of at least one of them (union) or all of them (intersection). */
464464
bool is_intersection = ZEND_TYPE_IS_INTERSECTION(proto_type);
465465
ZEND_TYPE_FOREACH(proto_type, single_type) {
466+
if (ZEND_TYPE_IS_INTERSECTION(*single_type)) {
467+
inheritance_status subtype_status = zend_is_class_subtype_of_type(
468+
fe_scope, fe_class_name, proto_scope, *single_type);
469+
470+
switch (subtype_status) {
471+
case INHERITANCE_ERROR:
472+
if (is_intersection) {
473+
return INHERITANCE_ERROR;
474+
}
475+
continue;
476+
case INHERITANCE_UNRESOLVED:
477+
have_unresolved = 1;
478+
continue;
479+
case INHERITANCE_SUCCESS:
480+
if (!is_intersection) {
481+
return INHERITANCE_SUCCESS;
482+
}
483+
continue;
484+
EMPTY_SWITCH_DEFAULT_CASE();
485+
}
486+
}
487+
466488
zend_class_entry *proto_ce;
467489
zend_string *proto_class_name = NULL;
468490
if (ZEND_TYPE_HAS_NAME(*single_type)) {

0 commit comments

Comments
 (0)