1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/reflection/tests/readonly_properties.phpt
Ilija Tovilo 8df557ac42 [RFC] Asymmetric visibility v2 (GH-15063)
Co-authored-by: Larry Garfield <larry@garfieldtech.com>
2024-08-27 02:04:48 +02:00

29 lines
593 B
PHP

--TEST--
Readonly property reflection
--FILE--
<?php
class Test {
public int $rw;
public readonly int $ro;
}
$rp = new ReflectionProperty(Test::class, 'rw');
var_dump($rp->isReadOnly());
var_dump(($rp->getModifiers() & ReflectionProperty::IS_READONLY) != 0);
$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 protected(set) readonly int $ro ]