/** * Gets line number for where the node is defined. * * The method `DOMNode::getLineNo()` does not return the correct line number for comment nodes. So this method * can return either the original line number returned by libxml or the fixed and correct line number * created by the `XMLDocument::fixLineNumbers()` method. * * @return int Either the original line number returned by libxml or the fixed and correct line number * created by the `XMLDocument::fixLineNumbers()` method. */ public function getLineNo() { $container = $this->ownerDocument->getLineNumberContainer(); if ($container && $container->contains($this)) { return $container->offsetGet($this); } return parent::getLineNo(); }