PhpParser\Node\Stmt\Function_::getReturnType PHP Method

getReturnType() public method

public getReturnType ( )
    public function getReturnType() {
        return $this->returnType;
    }

Usage Example

 /**
  * Get the return type declaration (only for PHP 7+ code)
  *
  * @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);
 }
All Usage Examples Of PhpParser\Node\Stmt\Function_::getReturnType