From 98489ab925c6bc761bbc1fc0549239531f22a6d5 Mon Sep 17 00:00:00 2001 From: Kaloyan Raev Date: Mon, 10 Oct 2016 18:32:02 +0300 Subject: [PATCH] Clearer $startLine calculation --- src/PhpDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpDocument.php b/src/PhpDocument.php index ef11328..8ea222a 100644 --- a/src/PhpDocument.php +++ b/src/PhpDocument.php @@ -176,7 +176,7 @@ class PhpDocument $diagnostics = []; foreach ($errors as $error) { $diagnostic = new Diagnostic(); - $startLine = $error->getStartLine() === -1 ? 0 : $error->getStartLine() - 1; + $startLine = max($error->getStartLine() - 1, 0); $startColumn = $error->hasColumnInfo() ? $error->getStartColumn($this->content) - 1 : 0; $endLine = $error->getEndLine() === -1 ? $startLine : $error->getEndLine() - 1; $endColumn = $error->hasColumnInfo() ? $error->getEndColumn($this->content) : 0;