static function getParamType(\ReflectionParameter $refParam)
    {
        $export = \ReflectionParameter::export([
                $refParam->getDeclaringClass()->name,
                $refParam->getDeclaringFunction()->name
            ],
            $refParam->name,
            true
        );

        $export =  str_replace(' or NULL', '', $export);

        $type = preg_replace('/.*?([\w\\\]+)\s+\$'.current(explode('=', $refParam->name)).'.*/', '\\1', $export);
        if( strpos($type, 'Parameter ') !== false ) {
            return '';
        }

        if( $type != 'array' && strpos($type, '\\') !== 0 ) {
            $type = '\\'.$type;
        }

        return $type;
    }
static function getParamType(\ReflectionParameter $refParam)
    {
        $export = \ReflectionParameter::export([
                $refParam->getDeclaringClass()->name,
                $refParam->getDeclaringFunction()->name
            ],
            $refParam->name,
            true
        );

        $export =  str_replace(' or NULL', '', $export);

        $type = preg_replace('/.*?([\w\\\]+)\s+\$'.current(explode('=', $refParam->name)).'.*/', '\\1', $export);
        if( strpos($type, 'Parameter ') !== false ) {
            return '';
        }

        if( $type != 'array' && strpos($type, '\\') !== 0 ) {
            $type = '\\'.$type;
        }

        return $type;
    }
static function getParamType ( \ ReflectionParameter $ refParam ) { $ export = \ ReflectionParameter :: export ( [ $ refParam -> getDeclaringClass ( ) -> name , $ refParam -> getDeclaringFunction ( ) -> name ] , $ refParam -> name , true ) ; $ export = str_replace ( ' or NULL' , '' , $ export ) ; $ type = preg_replace ( '/.*?([\w\\\]+)\s+\$' . current ( explode ( '=' , $ refParam -> name ) ) . '.*/' , '\\1' , $ export ) ; if ( strpos ( $ type , 'Parameter ' ) !== false ) { return '' ; } if ( $ type != 'array' && strpos ( $ type , '\\' ) !== 0 ) { $ type = '\\' . $ type ; } return $ type ; }
Tries to find out if the type of the given parameter. Will
return empty string if not possible.

@example
<code>
<?php
$reflector = new \\ReflectionClass('MyClass');
foreach($reflector->getMethods() as $method ) {
foreach($method->getParameters() as $param) {
$name = $param->getName();
$type = Reflector::getParamType($param);
printf("%s = %s\n", $name, $type);
}
}
</code>

@param \ReflectionParameter $refParam
@return string
Tries to find out if the type of the given parameter . Will return empty string if not possible .