public function getSubExpression()

in src/Reflection/ReflectionXHPChildrenDeclaration.hack [143:163]


  public function getSubExpression(): ReflectionXHPChildrenExpression {
    invariant(
      $this->getConstraintType() === XHPChildrenConstraintType::SUB_EXPR,
      'Only expression constraints have a single sub-expression - in %s',
      $this->context,
    );
    $data = $this->data[2];
    try {
      return new ReflectionXHPChildrenExpression(
        $this->context,
        $data as KeyedContainer<_, _>,
      );
    } catch (\TypeAssertionException $_) {
      throw new \Exception(
        'Expected a sub-expression, got a '.
        (\is_object($data) ? \get_class($data) : \gettype($data)).
        ' - in '.
        $this->context,
      );
    }
  }