mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Improve error message when overriding untyped property with typed property (GH-16866)
This commit is contained in:
parent
4b211a7769
commit
e5c2bc41ed
3 changed files with 3 additions and 3 deletions
|
@ -15,4 +15,4 @@ class Bar extends Foo
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--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--
|
--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))) {
|
} else if (UNEXPECTED(ZEND_TYPE_IS_SET(child_info->type) && !ZEND_TYPE_IS_SET(parent_info->type))) {
|
||||||
zend_error_noreturn(E_COMPILE_ERROR,
|
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(ce->name),
|
||||||
ZSTR_VAL(key),
|
ZSTR_VAL(key),
|
||||||
ZSTR_VAL(parent_info->ce->name));
|
ZSTR_VAL(parent_info->ce->name));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue