BetterReflection\Reflection\ReflectionParameter::getTypeHint PHP Méthode

getTypeHint() public méthode

Get the type hint declared for the parameter. This is the real type hint for the parameter, e.g. method(closure $someFunc) defined by the method itself, and is separate from the DocBlock type hints.
See also: getDocBlockTypes()
public getTypeHint ( ) : phpDocumentor\Reflection\Type
Résultat phpDocumentor\Reflection\Type
    public function getTypeHint()
    {
        $namespaceForType = $this->function instanceof ReflectionMethod ? $this->function->getDeclaringClass()->getNamespaceName() : $this->function->getNamespaceName();
        return (new FindTypeFromAst())->__invoke($this->node->type, $this->function->getLocatedSource(), $namespaceForType);
    }

Usage Example

Exemple #1
0
 /**
  * @return string
  */
 public function getHints()
 {
     $hints = $this->reflectionParameter->getDocBlockTypeStrings();
     $hints[] = $this->reflectionParameter->getTypeHint();
     $hints = array_filter($hints, 'strlen');
     return implode('|', $hints);
 }
All Usage Examples Of BetterReflection\Reflection\ReflectionParameter::getTypeHint