Skip to content

Commit 3b7edb6

Browse files
committed
Don't directly throw warning during method compatibility check
Only return the INHERITANCE_WARNING status.
1 parent 9939b2b commit 3b7edb6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Zend/zend_inheritance.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -668,14 +668,13 @@ static inheritance_status zend_do_perform_implementation_check(
668668
if (proto->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
669669
/* Removing a return type is not valid, unless the parent return type is tentative. */
670670
if (!(fe->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE)) {
671-
if (ZEND_ARG_TYPE_IS_TENTATIVE(&proto->common.arg_info[-1])) {
672-
if (status == INHERITANCE_SUCCESS) {
673-
emit_incompatible_method_error(fe, fe_scope, proto, proto_scope, INHERITANCE_WARNING);
674-
}
675-
return status;
676-
} else {
671+
if (!ZEND_ARG_TYPE_IS_TENTATIVE(&proto->common.arg_info[-1])) {
677672
return INHERITANCE_ERROR;
678673
}
674+
if (status == INHERITANCE_SUCCESS) {
675+
return INHERITANCE_WARNING;
676+
}
677+
return status;
679678
}
680679

681680
local_status = zend_perform_covariant_type_check(

0 commit comments

Comments
 (0)