PHPStan\Reflection\Php\PhpClassReflectionExtension::getReturnTypeStringFromMethod PHP Method

getReturnTypeStringFromMethod() private method

private getReturnTypeStringFromMethod ( ReflectionMethod $reflectionMethod ) : string | null
$reflectionMethod ReflectionMethod
return string | null
    private function getReturnTypeStringFromMethod(\ReflectionMethod $reflectionMethod)
    {
        $phpDoc = $reflectionMethod->getDocComment();
        if ($phpDoc === false) {
            return null;
        }
        $count = preg_match_all('#@return\\s+' . FileTypeMapper::TYPE_PATTERN . '#', $phpDoc, $matches);
        if ($count !== 1) {
            return null;
        }
        return $matches[1][0];
    }