(PHP 8)
ReflectionProperty::isPromoted — 检查属性是否已提升
此函数没有参数。
示例 #1 ReflectionProperty::isPromoted() 示例
<?php
class Foo {
public $baz;
public function __construct(public $bar) {}
}
$o = new Foo(42);
$o->baz = 42;
$ro = new ReflectionObject($o);
var_dump($ro->getProperty('bar')->isPromoted());
var_dump($ro->getProperty('baz')->isPromoted());
?>
上面的示例将输出
bool(true) bool(false)