1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix off-by-one error

Fixes #625
This commit is contained in:
Matt Brown 2018-03-27 14:43:39 -04:00
parent fd9e783a37
commit 3213695c95
2 changed files with 11 additions and 1 deletions

View File

@ -377,7 +377,7 @@ abstract class Type
$was_char = true;
} elseif ($char === '.') {
if ($i + 1 > $c || $chars[$i + 1] !== '.' || $chars[$i + 2] !== '.') {
if ($i + 2 > $c || $chars[$i + 1] !== '.' || $chars[$i + 2] !== '.') {
throw new TypeParseTreeException('Unexpected token ' . $char);
}

View File

@ -374,6 +374,16 @@ class TypeParseTest extends TestCase
Type::parseString('string...');
}
/**
* @expectedException \Psalm\Exception\TypeParseTreeException
*
* @return void
*/
public function testBadFullStop()
{
Type::parseString('string.');
}
/**
* @return void
*/