Returns whether the property has a given hook defined

# ReflectionProperty::hasHook

(PHP 8 >= 8.4.0)

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

### 说明

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

以上示例会输出：

    bool(true)
    bool(false)

### 参见

- ReflectionMethod
- PropertyHookType

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