protected function validateChildren()

in src/core/Node.hack [609:632]


  protected function validateChildren(): void {
    $decl = self::__xhpReflectionChildrenDeclaration();
    $type = $decl->getType();
    if ($type === XHPChildrenDeclarationType::ANY_CHILDREN) {
      return;
    }
    if ($type === XHPChildrenDeclarationType::NO_CHILDREN) {
      if ($this->children) {
        throw new \Facebook\XHP\InvalidChildrenException($this, 0);
      } else {
        return;
      }
    }
    list($ret, $ii) = $this->validateChildrenExpression(
      $decl->getExpression(),
      0,
    );
    if (!$ret || $ii < C\count($this->children)) {
      if (($this->children[$ii] ?? null) is \Facebook\XHP\AlwaysValidChild) {
        return;
      }
      throw new \Facebook\XHP\InvalidChildrenException($this, $ii);
    }
  }