public static function forFiles()

in src/Retriever/ClassRetriever.hack [45:83]


  public static function forFiles(
    keyset<string> $paths,
  ): dict<string, ResultOrException<ClassRetriever>> {
    if (\ini_get('hhvm.repo.authoritative')) {
      return Dict\map(
        $paths,
        $path ==> \Facebook\AutoloadMap\Generated\map()['class']
          |> Dict\filter($$, $class_path ==> $class_path === $path)
          |> Keyset\keys($$)
          |> new WrappedResult(new self($path, $$)),
      );
    }

    $all_facts = \HH\facts_parse(
      /* root = */ '/',
      varray($paths),
      /* force_hh = */ false,
      /* multithreaded = */ true,
    );
    return Dict\map(
      $paths,
      $path ==> {
        try {
          $file_facts = TypeAssert\matches_type_structure(
            type_structure(self::class, 'TFacts'),
            $all_facts[$path],
          );
          return new WrappedResult(new self(
            $path,
            Keyset\map($file_facts['types'], $type ==> $type['name']),
          ));
        } catch (TypeAssert\IncorrectTypeException $e) {
          return new WrappedException(
            new InvalidTestFileException('Could not parse file.'),
          );
        }
      },
    );
  }