array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'it', ), 'this' => array ( 0 => 'reflectionproperty.hashook.php', 1 => 'ReflectionProperty::hasHook', 2 => 'Returns whether the property has a given hook defined', ), 'up' => array ( 0 => 'class.reflectionproperty.php', 1 => 'ReflectionProperty', ), 'prev' => array ( 0 => 'reflectionproperty.hasdefaultvalue.php', 1 => 'ReflectionProperty::hasDefaultValue', ), 'next' => array ( 0 => 'reflectionproperty.hashooks.php', 1 => 'ReflectionProperty::hasHooks', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionproperty/hashook.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 8 >= 8.4.0)
ReflectionProperty::hasHook — Returns whether the property has a given hook defined
Returns whether the property has a given hook defined.
PropertyHookType
Example #1 ReflectionProperty::hasHook() example
<?php
class Example
{
public string $name { get => "Name here"; }
}
$rClass = new \ReflectionClass(Example::class);
$rProp = $rClass->getProperty('name');
var_dump($rProp->hasHook(PropertyHookType::Get));
var_dump($rProp->hasHook(PropertyHookType::Set));
?>
Il precedente esempio visualizzerĂ :
bool(true) bool(false)