/** * Returns the line in which this element first occured. * * @return int */ public function getLine() { if ($this->previousElement === null) { // First element is on line one. return 1; } else { $previousContent = $this->previousElement->getRawContent(); $previousLine = $this->previousElement->getLine(); return $previousLine + substr_count($previousContent, $this->phpcsFile->eolChar); } }