/** * @param NodeTrait $node * * @return $this */ protected function assertNotDescendant(self $node) { if ($node == $this || $node->isDescendantOf($this)) { throw new LogicException('Node must not be a descendant.'); } return $this; }