public function getSubExpressions()

in src/Reflection/ReflectionXHPChildrenDeclaration.hack [91:114]


  public function getSubExpressions(
  ): (ReflectionXHPChildrenExpression, ReflectionXHPChildrenExpression) {
    $type = $this->getType();
    invariant(
      $type === XHPChildrenExpressionType::SUB_EXPR_SEQUENCE ||
        $type === XHPChildrenExpressionType::SUB_EXPR_DISJUNCTION,
      'Only disjunctions and sequences have two sub-expressions - in %s',
      $this->context,
    );
    try {
      return tuple(
        new ReflectionXHPChildrenExpression(
          $this->context,
          $this->data[1] as KeyedContainer<_, _>,
        ),
        new ReflectionXHPChildrenExpression(
          $this->context,
          $this->data[2] as KeyedContainer<_, _>,
        ),
      );
    } catch (\TypeAssertionException $_) {
      throw new \Exception('Data is not subexpressions - in '.$this->context);
    }
  }