略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ReflectionProperty::hasHooks

2025-02-27

ReflectionProperty::hasHooks

(PHP 8 >= 8.4.0)

ReflectionProperty::hasHooksReturns whether the property has any hooks defined

说明

public ReflectionProperty::hasHooks(): bool
警告

本函数还未编写文档,仅有参数列表。

Returns whether the property has any hooks defined.

参数

此函数没有参数。

返回值

Returns true if the property has at least one hook defined, false otherwise.

示例

示例 #1 ReflectionProperty::hasHooks() example

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

public
string $none;
}

$rClass = new \ReflectionClass(Example::class);
var_dump($rClass->getProperty('name')->hasHooks());
var_dump($rClass->getProperty('none')->hasHooks());
?>

以上示例会输出:

bool(true)
bool(false)

注释

注意: This method is equivalent to checking ReflectionProperty::getHooks() against an empty array.

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。

官方地址:https://www.php.net/manual/en/reflectionproperty.hashooks.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3