ReflectionProperty::hasType

(PHP 7 >= 7.4.0, PHP 8)

ReflectionProperty::hasTypeVerifica si la propiedad tiene un tipo

Descripción

public ReflectionProperty::hasType(): bool

Verifica si la propiedad tiene un tipo asociado.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

true si se especifica un tipo, false en caso contrario.

Ejemplos

Ejemplo #1 Ejemplo de ReflectionProperty::hasType()

<?php
class User
{
public
string $name;
}

$rp = new ReflectionProperty('User', 'name');
var_dump($rp->hasType());
?>

El resultado del ejemplo sería:

bool(true)

Ver también

add a note

User Contributed Notes

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