PHPCD\PHPCD::functype PHP Method

functype() public method

For PHP7 or newer version, it tries to use the return type gramar to fetch the real return type. For PHP5, it use the docblock's return or var annotation to fetch the type.
public functype ( $class_name, $name ) : [type1,
return [type1,
    public function functype($class_name, $name)
    {
        if (version_compare(PHP_VERSION, '7.0.0') >= 0) {
            $type = $this->typeByReturnType($class_name, $name);
            if ($type) {
                return [$type];
            }
        }
        list($path, $doc) = $this->doc($class_name, $name);
        return $this->typeByDoc($path, $doc, $class_name);
    }