PHP 8.5.0 Alpha 1 available for testing

ReflectionProperty::hasHooks

(PHP 8 >= 8.4.0)

ReflectionProperty::hasHooksIndica si la propiedad tiene hooks definidos

Descripción

public ReflectionProperty::hasHooks(): bool
Advertencia

Esta función está actualmente no documentada; solo la lista de sus argumentos está disponible.

Indica si la propiedad tiene hooks definidos.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Devuelve true si la propiedad tiene al menos un hook definido, de lo contrario false.

Ejemplos

Ejemplo #1 Ejemplo de ReflectionProperty::hasHooks()

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

El ejemplo anterior mostrará :

bool(true)
bool(false)

Notas

Nota: Este método es equivalente a verificar ReflectionProperty::getHooks() con un array vacío.

Ver también

add a note

User Contributed Notes

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