Make line numbers for inheritance errors more precise

Use the line of the conflicting child method, rather than either the
first or last line of the class.
This commit is contained in:
Nikita Popov 2019-03-27 12:42:35 +01:00
parent fd5d659779
commit 251f293cb7
13 changed files with 16 additions and 13 deletions

View file

@ -639,7 +639,10 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
error_level = E_WARNING;
error_verb = "should";
}
zend_error(error_level, "Declaration of %s %s be compatible with %s", ZSTR_VAL(child_prototype), error_verb, ZSTR_VAL(method_prototype));
zend_error_at(error_level, NULL,
child->common.type == ZEND_USER_FUNCTION ? child->op_array.line_start : 0,
"Declaration of %s %s be compatible with %s",
ZSTR_VAL(child_prototype), error_verb, ZSTR_VAL(method_prototype));
zend_string_efree(child_prototype);
zend_string_efree(method_prototype);
}