BetterReflection\Reflection\ReflectionFunctionAbstract::getReturnType PHP Method

getReturnType() public method

Get the return type declaration (only for PHP 7+ code)
public getReturnType ( ) : ReflectionType | null
return ReflectionType | null
    public function getReturnType()
    {
        $namespaceForType = $this instanceof ReflectionMethod ? $this->getDeclaringClass()->getNamespaceName() : $this->getNamespaceName();
        $typeHint = (new FindTypeFromAst())->__invoke($this->node->getReturnType(), $this->getLocatedSource(), $namespaceForType);
        if (null === $typeHint) {
            return null;
        }
        return ReflectionType::createFromType($typeHint, false);
    }