array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'reflectionproperty.hashooks.php', 1 => 'ReflectionProperty::hasHooks', 2 => 'Returns whether the property has any hooks defined', ), 'up' => array ( 0 => 'class.reflectionproperty.php', 1 => 'ReflectionProperty', ), 'prev' => array ( 0 => 'reflectionproperty.hashook.php', 1 => 'ReflectionProperty::hasHook', ), 'next' => array ( 0 => 'reflectionproperty.hastype.php', 1 => 'ReflectionProperty::hasType', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionproperty/hashooks.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ReflectionProperty::hasHooks

(PHP 8 >= 8.4.0)

ReflectionProperty::hasHooksReturns whether the property has any hooks defined

Опис

public ReflectionProperty::hasHooks(): bool
Увага

Наразі ця функція не документована. Доступний лише список її параметрів.

Returns whether the property has any hooks defined.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns true if the property has at least one hook defined, false otherwise.

Приклади

Приклад #1 ReflectionProperty::hasHooks() example

<?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());
?>

Поданий вище приклад виведе:

bool(true)
bool(false)

Примітки

Зауваження: This method is equivalent to checking ReflectionProperty::getHooks() against an empty array.

Прогляньте також