src/Psalm/Internal/LanguageServer/LanguageServer.php
public static function uriToPath(string $uri)
    {
        $fragments = parse_url($uri);
        if ($fragments === false || !isset($fragments['scheme']) || $fragments['scheme'] !== 'file') {
            throw new \InvalidArgumentException("Not a valid file URI: $uri");
        }
        $filepath = urldecode((string) $fragments['path']);
        if (strpos($filepath, ':') !== false) {
            if ($filepath[0] === '/') {
                $filepath = substr($filepath, 1);
            }
            $filepath = str_replace('/', '\\', $filepath);
        }
        return $filepath;
    }
public static function uriToPath(string $uri)
    {
        $fragments = parse_url($uri);
        if ($fragments === false || !isset($fragments['scheme']) || $fragments['scheme'] !== 'file') {
            throw new \InvalidArgumentException("Not a valid file URI: $uri");
        }
        $filepath = urldecode((string) $fragments['path']);
        if (strpos($filepath, ':') !== false) {
            if ($filepath[0] === '/') {
                $filepath = substr($filepath, 1);
            }
            $filepath = str_replace('/', '\\', $filepath);
        }
        return $filepath;
    }
public static function uriToPath ( string $ uri ) { $ fragments = parse_url ( $ uri ) ; if ( $ fragments === false || ! isset ( $ fragments [ 'scheme' ] ) || $ fragments [ 'scheme' ] !== 'file' ) { throw new \ InvalidArgumentException ( "Not a valid file URI: $uri" ) ; } $ filepath = urldecode ( ( string ) $ fragments [ 'path' ] ) ; if ( strpos ( $ filepath , ':' ) !== false ) { if ( $ filepath [ 0 ] === '/' ) { $ filepath = substr ( $ filepath , 1 ) ; } $ filepath = str_replace ( '/' , '\\' , $ filepath ) ; } return $ filepath ; }
Transforms URI into file path

@param string $uri
@return string
Transforms URI into file path