ReflectionType::__toString

(PHP 7)
To string
public string ReflectionType::__toString ( void )

Gets the parameter type name.

Returns:

Returns the type of the parameter.

Examples:
ReflectionType::__toString() example
<?php
function someFunction(string $param) {}

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

echo $reflectionParam->getType();

The above example will output something similar to:

string
See also:

ReflectionType::allowsNull() -

ReflectionType::isBuiltin() -

ReflectionParameter::getType() -

doc_php
2016-02-24 16:13:52
Comments
Leave a Comment

Please login to continue.