Don't directly throw warning during method compatibility check

Only return the INHERITANCE_WARNING status.
This commit is contained in:
Nikita Popov 2021-05-17 10:16:47 +02:00
parent 9939b2b71f
commit 3b7edb6587

View file

@ -668,14 +668,13 @@ static inheritance_status zend_do_perform_implementation_check(
if (proto->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
/* Removing a return type is not valid, unless the parent return type is tentative. */
if (!(fe->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE)) {
if (ZEND_ARG_TYPE_IS_TENTATIVE(&proto->common.arg_info[-1])) {
if (status == INHERITANCE_SUCCESS) {
emit_incompatible_method_error(fe, fe_scope, proto, proto_scope, INHERITANCE_WARNING);
}
return status;
} else {
if (!ZEND_ARG_TYPE_IS_TENTATIVE(&proto->common.arg_info[-1])) {
return INHERITANCE_ERROR;
}
if (status == INHERITANCE_SUCCESS) {
return INHERITANCE_WARNING;
}
return status;
}
local_status = zend_perform_covariant_type_check(