/** * @param AbstractBlock $block * * @return AbstractBlock */ public function addBlock(AbstractBlock $block) { $this->getBlockCloser()->closeUnmatchedBlocks(); $block->setStartLine($this->lineNumber); while (!$this->tip->canContain($block)) { $this->tip->finalize($this, $this->lineNumber); } $this->tip->appendChild($block); $this->tip = $block; $this->container = $block; return $block; }