reflection.php
protected function getReturnType($method)
    {
        // Guard: method getReturnType() is only supported by PHP7.0+
        if (PHP_VERSION_ID >= 70000) {
            $returnType = (string) $method->getReturnType();

            if('self' === $returnType) {
                $returnType = "\\".$this->method->getDeclaringClass()->getName();
            }

            // Guard: method getReturnType()->allowsNull() is only supported by PHP7.1+
            if(PHP_VERSION_ID >= 70100) {
                $returnType = '?'.$returnType;
            }

            if($returnType != '') {
                return ': '. $returnType;
            }
        } 
            
        // the return type feature doesn't exist below PHP7, return empty string
        return '';        
    }
protected function getReturnType($method)
    {
        // Guard: method getReturnType() is only supported by PHP7.0+
        if (PHP_VERSION_ID >= 70000) {
            $returnType = (string) $method->getReturnType();

            if('self' === $returnType) {
                $returnType = "\\".$this->method->getDeclaringClass()->getName();
            }

            // Guard: method getReturnType()->allowsNull() is only supported by PHP7.1+
            if(PHP_VERSION_ID >= 70100) {
                $returnType = '?'.$returnType;
            }

            if($returnType != '') {
                return ': '. $returnType;
            }
        } 
            
        // the return type feature doesn't exist below PHP7, return empty string
        return '';        
    }
getReturnType

@param ReflectionMethod $method   Method object from reflection API

@return string The Parameters string for a method.