1
0
Fork 0

Clearer $startLine calculation

pull/62/head
Kaloyan Raev 2016-10-10 18:32:02 +03:00
parent 8f68e0c9e3
commit 98489ab925
1 changed files with 1 additions and 1 deletions

View File

@ -176,7 +176,7 @@ class PhpDocument
$diagnostics = []; $diagnostics = [];
foreach ($errors as $error) { foreach ($errors as $error) {
$diagnostic = new Diagnostic(); $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; $startColumn = $error->hasColumnInfo() ? $error->getStartColumn($this->content) - 1 : 0;
$endLine = $error->getEndLine() === -1 ? $startLine : $error->getEndLine() - 1; $endLine = $error->getEndLine() === -1 ? $startLine : $error->getEndLine() - 1;
$endColumn = $error->hasColumnInfo() ? $error->getEndColumn($this->content) : 0; $endColumn = $error->hasColumnInfo() ? $error->getEndColumn($this->content) : 0;