ReflectionType::__toString

(PHP 7, PHP 8)

ReflectionType::__toStringTo string

Beschreibung

publicReflectionType::__toString(): string

Gets the parameter type name.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Returns the type of the parameter.

Changelog

VersionBeschreibung
8.0.0ReflectionType::__toString() has been undeprecated.
7.1.0ReflectionType::__toString() has been deprecated.

Beispiele

Beispiel #1 ReflectionType::__toString() example

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

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

echo
$reflectionParam->getType();

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

string

Siehe auch

To Top