ReflectionProperty::hasHook

(PHP 8 >= 8.4.0)

ReflectionProperty::hasHookReturns whether the property has a given hook defined.

Описание

public ReflectionProperty::hasHook(PropertyHookType $type): bool

Returns whether the property has a given hook defined.

Список параметров

PropertyHookType
The type of hook to check for.

Возвращаемые значения

Returns true if the hook is defined on this property, false if not.

Примеры

Пример #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));
?>

Смотрите также

Добавить

Примечания пользователей

Пользователи ещё не добавляли примечания для страницы
To Top