protected function set()

in src/CLIOptions/CLIOptionWithRequiredEnumValue.hack [68:82]


  protected function set(string $as_given, string $value): void {
    $enum = $this->enumname;
    if (!$enum::isValid($value)) {
      throw new InvalidArgumentException(
        "'%s' is not a valid value for '%s' - valid values are: %s",
        $value,
        $as_given,
        $enum::getValues()
          |> Vec\map($$, $v ==> (string) $v)
          |> Str\join($$, ' | '),
      );
    }
    $setter = $this->setter;
    $setter($enum::assert($value));
  }