in src/TreeParser.hack [19:56]
public static async function fromPathAsync(
string $path,
): Awaitable<TreeParser> {
$scopes = vec[];
$rdi = new \RecursiveDirectoryIterator($path);
$rii = new \RecursiveIteratorIterator($rdi);
$parsers = vec[];
foreach ($rii as $info) {
if (!$info->isFile()) {
continue;
}
if (!$info->isReadable()) {
continue;
}
$ext = $info->getExtension();
if ($ext !== 'php' && $ext !== 'hh' && $ext !== 'xhp' && $ext !== 'hack' && $ext !== 'hck') {
continue;
}
$parsers[] = FileParser::fromFileAsync($info->getPathname());
}
$scopes = await Vec\map_async(
$parsers,
async $p ==> {
$p = await $p;
return $p->defs;
},
);
return new self(merge_scopes(
null,
shape(
'filename' => '__TREE__',
'sourceType' => SourceType::MULTIPLE_FILES,
),
$scopes,
));
}