diff --git a/src/Psalm/CodeLocation.php b/src/Psalm/CodeLocation.php index 0644fc8e1..6e3efaf56 100644 --- a/src/Psalm/CodeLocation.php +++ b/src/Psalm/CodeLocation.php @@ -27,7 +27,7 @@ class CodeLocation public $file_name; /** @var int */ - protected $line_number; + public $raw_line_number; /** @var int */ private $end_line_number = -1; @@ -123,7 +123,7 @@ class CodeLocation $doc_comment = $stmt->getDocComment(); $this->preview_start = $doc_comment ? $doc_comment->getFilePos() : $this->file_start; $this->docblock_start_line_number = $doc_comment ? $doc_comment->getLine() : null; - $this->line_number = $stmt->getLine(); + $this->raw_line_number = $stmt->getLine(); } /** @@ -324,7 +324,7 @@ class CodeLocation */ public function getLineNumber() { - return $this->docblock_line_number ?: $this->line_number; + return $this->docblock_line_number ?: $this->raw_line_number; } /** @@ -409,4 +409,9 @@ class CodeLocation { return $this->file_name . ':' . $this->getLineNumber() . ':' . $this->getColumn(); } + + public function getQuickSummary() : string + { + return $this->file_name . ':' . $this->raw_line_number; + } } diff --git a/src/Psalm/CodeLocation/DocblockTypeLocation.php b/src/Psalm/CodeLocation/DocblockTypeLocation.php index 6ed0dff7e..b659790e2 100644 --- a/src/Psalm/CodeLocation/DocblockTypeLocation.php +++ b/src/Psalm/CodeLocation/DocblockTypeLocation.php @@ -25,6 +25,6 @@ class DocblockTypeLocation extends \Psalm\CodeLocation $this->single_line = false; $this->preview_start = $this->file_start; - $this->line_number = $line_number; + $this->raw_line_number = $line_number; } } diff --git a/src/Psalm/CodeLocation/ParseErrorLocation.php b/src/Psalm/CodeLocation/ParseErrorLocation.php index e1d2506ac..6949945b8 100644 --- a/src/Psalm/CodeLocation/ParseErrorLocation.php +++ b/src/Psalm/CodeLocation/ParseErrorLocation.php @@ -27,7 +27,7 @@ class ParseErrorLocation extends \Psalm\CodeLocation $this->single_line = false; $this->preview_start = $this->file_start; - $this->line_number = substr_count( + $this->raw_line_number = substr_count( substr($file_contents, 0, $this->file_start), "\n" ) + 1; diff --git a/src/Psalm/CodeLocation/Raw.php b/src/Psalm/CodeLocation/Raw.php index 0a8eaa312..6b82d2227 100644 --- a/src/Psalm/CodeLocation/Raw.php +++ b/src/Psalm/CodeLocation/Raw.php @@ -26,7 +26,7 @@ class Raw extends \Psalm\CodeLocation $this->single_line = false; $this->preview_start = $this->file_start; - $this->line_number = substr_count( + $this->raw_line_number = substr_count( substr($file_contents, 0, $this->file_start), "\n" ) + 1;