ReflectionProperty::hasHook

(PHP 8 >= 8.4.0)

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

Descrição

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

Returns whether the property has a given hook defined.

Parâmetros

PropertyHookType
The type of hook to check for.

Valor Retornado

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

Exemplos

Exemplo #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));
?>

Veja Também

adicione uma nota

Notas Enviadas por Usuários (em inglês)

Não há notas de usuários para esta página.
To Top