ReflectionType::__toString

(PHP 7, PHP 8)

ReflectionType::__toStringTo string

Descripción

publicReflectionType::__toString(): string

Gets the parameter type name.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Returns the type of the parameter.

Historial de cambios

VersiónDescripción
8.0.0ReflectionType::__toString() has been undeprecated.
7.1.0ReflectionType::__toString() has been deprecated.

Ejemplos

Ejemplo #1 ReflectionType::__toString() example

<?php
function someFunction(string $param) {}

$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParam = $reflectionFunc->getParameters()[0];

echo
$reflectionParam->getType();

El resultado del ejemplo sería algo similar a:

string

Ver también

To Top