mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Use unmangled named in property type inheritance error
This commit is contained in:
parent
84354c62b3
commit
5fcc12f505
2 changed files with 12 additions and 1 deletions
|
@ -0,0 +1,11 @@
|
||||||
|
--TEST--
|
||||||
|
Typed property invariance violation for protected properties
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class A { protected int $x; }
|
||||||
|
class B extends A { protected $x; }
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Fatal error: Type of B::$x must be int (as in class A) in %s on line %d
|
|
@ -936,7 +936,7 @@ static void emit_incompatible_property_error(
|
||||||
zend_error_noreturn(E_COMPILE_ERROR,
|
zend_error_noreturn(E_COMPILE_ERROR,
|
||||||
"Type of %s::$%s must be %s%s (as in class %s)",
|
"Type of %s::$%s must be %s%s (as in class %s)",
|
||||||
ZSTR_VAL(child->ce->name),
|
ZSTR_VAL(child->ce->name),
|
||||||
ZSTR_VAL(child->name),
|
zend_get_unmangled_property_name(child->name),
|
||||||
ZEND_TYPE_ALLOW_NULL(parent->type) ? "?" : "",
|
ZEND_TYPE_ALLOW_NULL(parent->type) ? "?" : "",
|
||||||
ZEND_TYPE_IS_CLASS(parent->type)
|
ZEND_TYPE_IS_CLASS(parent->type)
|
||||||
? ZSTR_VAL(ZEND_TYPE_IS_CE(parent->type) ? ZEND_TYPE_CE(parent->type)->name : resolve_class_name(parent->ce, ZEND_TYPE_NAME(parent->type)))
|
? ZSTR_VAL(ZEND_TYPE_IS_CE(parent->type) ? ZEND_TYPE_CE(parent->type)->name : resolve_class_name(parent->ce, ZEND_TYPE_NAME(parent->type)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue