public function appendToBuilder()

in src/CodegenTypeConstant.hack [61:78]


  public function appendToBuilder(HackBuilder $builder): HackBuilder {
    $value = $this->getValue();
    $abstract = $this->isAbstract();
    $constraint = $this->getConstraint();
    invariant(
      ($value !== null) !== $abstract,
      'type constants must either be abstract or have a value',
    );
    return $builder
      ->addDocBlock($this->getDocBlock())
      ->ensureNewLine()
      ->addIf($abstract, 'abstract ')
      ->add('const type ')
      ->add($this->getName())
      ->addIf($constraint !== null, ' '.($constraint ?? ''))
      ->addIf($value !== null, ' = '.($value ?? ''))
      ->addLine(';');
  }