diff --git a/lib/PhpParser/Error.php b/lib/PhpParser/Error.php index 4cdf108..21d67d5 100644 --- a/lib/PhpParser/Error.php +++ b/lib/PhpParser/Error.php @@ -93,7 +93,7 @@ class Error extends \RuntimeException } /** - * Gets the start column (0-based) into the line where the error started. + * Gets the start column (1-based) into the line where the error started. * * @param string $code Source code of the file * @return int @@ -107,7 +107,7 @@ class Error extends \RuntimeException } /** - * Gets the end column (0-based) into the line where the error ended. + * Gets the end column (1-based) into the line where the error ended. * * @param string $code Source code of the file * @return int @@ -130,7 +130,7 @@ class Error extends \RuntimeException $lineStartPos = -1; } - return $pos - $lineStartPos - 1; + return $pos - $lineStartPos; } /** diff --git a/test/PhpParser/ErrorTest.php b/test/PhpParser/ErrorTest.php index a94e542..781eeb3 100644 --- a/test/PhpParser/ErrorTest.php +++ b/test/PhpParser/ErrorTest.php @@ -49,21 +49,21 @@ class ErrorTest extends \PHPUnit_Framework_TestCase public function provideTestColumnInfo() { return array( // Error at "bar" - array("