mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
RFC: https://wiki.php.net/rfc/isreadable-iswriteable Fixes GH-15309 Fixes GH-16175 Closes GH-16209
30 lines
512 B
PHP
30 lines
512 B
PHP
--TEST--
|
|
Test ReflectionProperty::isReadable() lazy
|
|
--CREDITS--
|
|
Arnaud Le Blanc (arnaud-lb)
|
|
--FILE--
|
|
<?php
|
|
|
|
class A {
|
|
public int $a;
|
|
public 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->isReadable(null, $obj));
|
|
|
|
$rp = new ReflectionProperty(A::class, 'b');
|
|
var_dump($rp->isReadable(null, $obj));
|
|
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(false)
|