ReflectionProperty::getHook

(PHP 8 >= 8.4.0)

ReflectionProperty::getHookReturns a reflection object for a specified hook.

Descrição

public ReflectionProperty::getHook(PropertyHookType $type): ?ReflectionMethod

Gets the reflection of the property's hook, if any.

Parâmetros

PropertyHookType
The type of hook to request.

Valor Retornado

If the requested hook is defined, a ReflectionMethod instance will be returned. If not, the method will return null

Exemplos

Exemplo #1 ReflectionProperty::getHook() example

<?php
class Example
{
public
string $name { get => "Name here"; }
}

$rClass = new \ReflectionClass(Example::class);
$rProp = $rClass->getProperty('name');
var_dump($rProp->getHook(PropertyHookType::Get));
var_dump($rProp->getHook(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