ReflectionProperty::isPromoted
PHP function
Edit on GitHub ✎
(PHP 8)
Checks if property is promoted
Description
ReflectionProperty::isPromoted(): bool
Checks whether the property is promoted
Parameters Parameters
Return Values
true if the property is promoted, false otherwise.
Examples
ReflectionProperty::isPromoted example
php
<?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:
output
bool(true)
bool(false)See Also
ReflectionProperty::isDefaultReflectionProperty::isInitializedReflectionProperty::getValue