mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Display the readonly property modifier when printing reflection info
This commit is contained in:
parent
f5ee3429db
commit
8d25b62414
@ -891,6 +891,9 @@ static void _property_string(smart_str *str, zend_property_info *prop, const cha
|
||||
if (prop->flags & ZEND_ACC_STATIC) {
|
||||
smart_str_appends(str, "static ");
|
||||
}
|
||||
if (prop->flags & ZEND_ACC_READONLY) {
|
||||
smart_str_appends(str, "readonly ");
|
||||
}
|
||||
if (ZEND_TYPE_IS_SET(prop->type)) {
|
||||
zend_string *type_str = zend_type_to_string(prop->type);
|
||||
smart_str_append(str, type_str);
|
||||
|
@ -16,9 +16,13 @@ $rp = new ReflectionProperty(Test::class, 'ro');
|
||||
var_dump($rp->isReadOnly());
|
||||
var_dump(($rp->getModifiers() & ReflectionProperty::IS_READONLY) != 0);
|
||||
|
||||
$rp = new ReflectionProperty(Test::class, 'ro');
|
||||
echo $rp;
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Property [ public readonly int $ro ]
|
||||
|
Loading…
Reference in New Issue
Block a user