Skip to content

Commit d393a1d

Browse files
committed
Tests about consuming TOKEN_END
1 parent 326d512 commit d393a1d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\PhpDoc;
4+
5+
use PHPStan\PhpDocParser\Parser\ParserException;
6+
use PHPStan\Testing\PHPStanTestCase;
7+
8+
class PhpDocStringResolverTest extends PHPStanTestCase
9+
{
10+
11+
public function testConsumeEnd(): void
12+
{
13+
$phpDocStringResolver = self::getContainer()->getByType(PhpDocStringResolver::class);
14+
15+
$this->expectException(ParserException::class);
16+
$this->expectExceptionMessage('Unexpected token "test", expected TOKEN_END at offset 25 on line 1');
17+
$phpDocStringResolver->resolve('/** @param int $test */ test');
18+
}
19+
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\PhpDoc;
4+
5+
use PHPStan\PhpDocParser\Parser\ParserException;
6+
use PHPStan\Testing\PHPStanTestCase;
7+
8+
class TypeStringResolverTest extends PHPStanTestCase
9+
{
10+
11+
public function testConsumeEnd(): void
12+
{
13+
$typeStringResolver = self::getContainer()->getByType(TypeStringResolver::class);
14+
15+
$this->expectException(ParserException::class);
16+
$this->expectExceptionMessage('Unexpected token "int", expected TOKEN_END at offset 7 on line 1');
17+
$typeStringResolver->resolve('string int');
18+
}
19+
20+
}

0 commit comments

Comments
 (0)