From 8c4ef2aefd9788238897b678a985e1d5c8df6db4 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Tue, 4 Jun 2019 20:22:42 +0200 Subject: [PATCH] Add parse error test --- tests/PHPStan/Parser/TypeParserTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/PHPStan/Parser/TypeParserTest.php b/tests/PHPStan/Parser/TypeParserTest.php index d09e73e..a9e5e8d 100644 --- a/tests/PHPStan/Parser/TypeParserTest.php +++ b/tests/PHPStan/Parser/TypeParserTest.php @@ -447,6 +447,24 @@ class TypeParserTest extends \PHPUnit\Framework\TestCase Lexer::TOKEN_CLOSE_CURLY_BRACKET ), ], + [ + 'array{"a": int}', + new \PHPStan\PhpDocParser\Parser\ParserException( + '"a"', + Lexer::TOKEN_DOUBLE_QUOTED_STRING, + 6, + Lexer::TOKEN_IDENTIFIER + ), + ], + [ + 'array{\'a\': int}', + new \PHPStan\PhpDocParser\Parser\ParserException( + '\'a\'', + Lexer::TOKEN_SINGLE_QUOTED_STRING, + 6, + Lexer::TOKEN_IDENTIFIER + ), + ], [ 'callable(): Foo', new CallableTypeNode(