GoLang ReflectionParameter::hasType

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



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

PHP ReflectionParameter::hasType

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

ReflectionParameter::hasType

(PHP 7)

ReflectionParameter::hasTypeChecks if parameter has a type

Description

public bool ReflectionParameter::hasType ( void )

Checks if the parameter has a type associated with it.

Parameters

This function has no parameters.

Return Values

TRUE if a type is specified, FALSE otherwise.

Examples

Example #1 ReflectionParameter::hasType() example

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

$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParams $reflectionFunc->getParameters();

var_dump($reflectionParams[0]->hasType());
var_dump($reflectionParams[1]->hasType());

The above example will output something similar to:

bool(true)
bool(false)

See Also