ReflectionProperty::hasHooks
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.4.0)
Returns whether the property has any hooks defined
Description
ReflectionProperty::hasHooks(): bool
Func
Returns whether the property has any hooks defined.
Parameters Parameters
Return Values
Returns true if the property has at least one hook defined, false otherwise.
Examples
ReflectionProperty::hasHooks example
php
<?php
class Example
{
public string $name { get => "Name here"; }
public string $none;
}
$rClass = new \ReflectionClass(Example::class);
var_dump($rClass->getProperty('name')->hasHooks());
var_dump($rClass->getProperty('none')->hasHooks());
?>The above example will output:
output
bool(true)
bool(false)Notes
Note
This method is equivalent to checking ReflectionProperty::getHooks against an empty array.
See Also
ReflectionProperty::getHooks