Mockery\Generator\Method::getReturnType PHP Method

getReturnType() public method

public getReturnType ( )
    public function getReturnType()
    {
        if (version_compare(PHP_VERSION, '7.0.0-dev') >= 0 && $this->method->hasReturnType()) {
            $returnType = (string) $this->method->getReturnType();
            if ('self' === $returnType) {
                $returnType = "\\" . $this->method->getDeclaringClass()->getName();
            }
            if (version_compare(PHP_VERSION, '7.1.0-dev') >= 0 && $this->method->getReturnType()->allowsNull()) {
                $returnType = '?' . $returnType;
            }
            return $returnType;
        }
        return '';
    }

Usage Example

示例#1
0
 protected function renderReturnType(Method $method)
 {
     $type = $method->getReturnType();
     return $type ? sprintf(': %s', $type) : '';
 }
All Usage Examples Of Mockery\Generator\Method::getReturnType