ReflectionProperty::hasHook

(PHP 8 >= 8.4.0)

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

Descrizione

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

Returns whether the property has a given hook defined.

Elenco dei parametri

PropertyHookType
The type of hook to check for.

Valori restituiti

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

Esempi

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

Vedere anche:

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top