# ReflectionProperty::hasHook

(PHP 8 >= 8.4.0)

ReflectionProperty::hasHook — Returns whether the property has a given hook defined

### Beschreibung

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

Returns whether the property has a given hook defined.

### Parameter-Liste

`PropertyHookType`
  The type of hook to check for.

### Rückgabewerte

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

### Beispiele

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

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

    bool(true)
    bool(false)

### Siehe auch

- ReflectionMethod
- PropertyHookType

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open