private function getFormattedOptions()

in src/HackfmtFormatter.hack [53:76]


  private function getFormattedOptions(): string {
    $options = vec[
      '--indent-width',
      (string) $this->config->getSpacesPerIndentation(),
      '--line-width',
      (string) $this->config->getMaxLineLength(),
    ];

    if ($this->config->shouldUseTabs()) {
      $options[] = '--tabs';
    }

    // HHVM < 4.48 always formats generated code. HHVM 4.48 never does (so this
    // formatter is broken on that version). HHVM >= 4.49 formats generated code
    // iff the following flag is provided:
    if (\version_compare(\HHVM_VERSION, '4.49') >= 0) {
      $options[] = '--format-generated-code';
    }

    return Vec\map(
      $options,
      $option ==> \escapeshellarg($option),
    ) |> Str\join($$, ' ');
  }