Documentación offline PHP master

ReflectionProperty::getType

master Ver versión oficial en línea Licencia CC-BY-3.0Descargado el 2026-08-02

En esta página

ReflectionProperty::getType

Obtiene el tipo de una propiedad

Descripción#

public ReflectionProperty::getType(): ReflectionType
```php

Obtiene el tipo asociado a una propiedad.

## Parámetros

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

## Valores devueltos

Devuelve una `ReflectionType` si la propiedad tiene un tipo, y `null` en caso contrario.

## Ejemplos

Ejemplo de ReflectionProperty::getType
getType()->getName(); ?>

```php

El ejemplo anterior mostrará:

string

Véase también#

ReflectionProperty::hasType

ReflectionProperty::isInitialized