GoLang ReflectionParameter::getType

request it (296)
GoLang replacement for PHP's ReflectionParameter::getType [edit | history]



Do you know a GoLang replacement for PHP's ReflectionParameter::getType? Write it!

PHP ReflectionParameter::getType

PHP original manual for ReflectionParameter::getType [ show | php.net ]

ReflectionParameter::getType

(PHP 7)

ReflectionParameter::getTypeGets a parameter's type

Description

public ReflectionType ReflectionParameter::getType ( void )

Gets the associated type of a parameter.

Parameters

This function has no parameters.

Return Values

Returns a ReflectionType object if a parameter type is specified, NULL otherwise.

Examples

Example #1 ReflectionParameter::getType() example

<?php
function someFunction(int $param$param2) {}

$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParams $reflectionFunc->getParameters();
$reflectionType1 $reflectionParams[0]->getType();
$reflectionType2 $reflectionParams[1]->getType();

echo 
$reflectionType1;
var_dump($reflectionType2);

The above example will output something similar to:

int
null

See Also