mirror of
https://github.com/php/php-src.git
synced 2026-04-26 01:18:19 +02:00
e4f727d61e
RFC: https://wiki.php.net/rfc/isreadable-iswriteable Fixes GH-15309 Fixes GH-16175 Closes GH-16209
30 lines
554 B
PHP
30 lines
554 B
PHP
--TEST--
|
|
Test ReflectionProperty::isWritable() lazy
|
|
--CREDITS--
|
|
Arnaud Le Blanc (arnaud-lb)
|
|
--FILE--
|
|
<?php
|
|
|
|
class A {
|
|
public public(set) readonly int $a;
|
|
public public(set) readonly int $b;
|
|
|
|
public function __construct() {
|
|
$this->a = 1;
|
|
}
|
|
}
|
|
|
|
$rc = new ReflectionClass(A::class);
|
|
$obj = $rc->newLazyProxy(fn() => new A());
|
|
|
|
$rp = new ReflectionProperty(A::class, 'a');
|
|
var_dump($rp->isWritable(null, $obj));
|
|
|
|
$rp = new ReflectionProperty(A::class, 'b');
|
|
var_dump($rp->isWritable(null, $obj));
|
|
|
|
?>
|
|
--EXPECT--
|
|
bool(false)
|
|
bool(true)
|