public function __construct()

in src/CLIOptions/CLIOption.hack [41:76]


  public function __construct(
    private string $helpText,
    string $long,
    ?string $short,
  ) {
    invariant(
      Str\starts_with($long, '--'),
      "long argument '%s' doesn't start with '--'",
      $long,
    );
    $this->long = Str\strip_prefix($long, '--');
    invariant(
      Str\length($this->long) > 0,
      'long argument length should be greater than zero',
    );
    if ($short === null) {
      return;
    }

    invariant(
      Str\starts_with($short, '-'),
      "short argument '%s' doesn't start with '-'",
      $short,
    );
    invariant(
      !Str\starts_with($short, '--'),
      "short argument '%s' shouldn't start with '--'",
      $short,
    );
    $this->short = Str\strip_prefix($short, '-');
    invariant(
      Str\length((string)$this->short) === 1,
      "short argument '%s' length should be equal to 1",
      $short,
    );
  }