ReflectionProperty::isPromoted
(PHP 8)
ReflectionProperty::isPromoted — Checks if property is promoted
Description
Checks whether the property is promoted
Parameters
This function has no parameters.
Examples
Example #1 ReflectionProperty::isPromoted() example
<?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());
?>The above example will output:
bool(true) bool(false)
See Also
- ReflectionProperty::isDefault() - Checks if property is a default property
- ReflectionProperty::isInitialized() - Checks whether a property is initialized
- ReflectionProperty::getValue() - Gets value
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
