mirror of
https://github.com/php/php-src.git
synced 2024-11-23 01:44:06 +08:00
Improve error message when overriding untyped property with typed property (GH-16866)
This commit is contained in:
parent
4b211a7769
commit
e5c2bc41ed
@ -15,4 +15,4 @@ class Bar extends Foo
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Type of Bar::$property1 must not be defined (as in class Foo) in %s on line %d
|
||||
Fatal error: Type of Bar::$property1 must be omitted to match the parent definition in class Foo in %s on line %d
|
||||
|
@ -11,4 +11,4 @@ class Baz extends Foo{
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Type of Baz::$bar must not be defined (as in class Foo) in %s on line 6
|
||||
Fatal error: Type of Baz::$bar must be omitted to match the parent definition in class Foo in %s on line 6
|
||||
|
@ -1507,7 +1507,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
|
||||
}
|
||||
} else if (UNEXPECTED(ZEND_TYPE_IS_SET(child_info->type) && !ZEND_TYPE_IS_SET(parent_info->type))) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR,
|
||||
"Type of %s::$%s must not be defined (as in class %s)",
|
||||
"Type of %s::$%s must be omitted to match the parent definition in class %s",
|
||||
ZSTR_VAL(ce->name),
|
||||
ZSTR_VAL(key),
|
||||
ZSTR_VAL(parent_info->ce->name));
|
||||
|
Loading…
Reference in New Issue
Block a user