55use Exception ;
66use PHPStan \PhpDocParser \Ast \ConstExpr \ConstExprFloatNode ;
77use PHPStan \PhpDocParser \Ast \ConstExpr \ConstExprIntegerNode ;
8- use PHPStan \PhpDocParser \Ast \ConstExpr \ConstExprStringNode ;
98use PHPStan \PhpDocParser \Ast \ConstExpr \ConstFetchNode ;
9+ use PHPStan \PhpDocParser \Ast \ConstExpr \QuoteAwareConstExprStringNode ;
1010use PHPStan \PhpDocParser \Ast \Type \ArrayShapeItemNode ;
1111use PHPStan \PhpDocParser \Ast \Type \ArrayShapeNode ;
1212use PHPStan \PhpDocParser \Ast \Type \ArrayTypeNode ;
@@ -43,7 +43,7 @@ protected function setUp(): void
4343 {
4444 parent ::setUp ();
4545 $ this ->lexer = new Lexer ();
46- $ this ->typeParser = new TypeParser (new ConstExprParser () );
46+ $ this ->typeParser = new TypeParser (new ConstExprParser (true , true ), true );
4747 }
4848
4949
@@ -481,7 +481,7 @@ public function provideParseData(): array
481481 'array{"a": int} ' ,
482482 new ArrayShapeNode ([
483483 new ArrayShapeItemNode (
484- new ConstExprStringNode ('a ' ),
484+ new QuoteAwareConstExprStringNode ('a ' , QuoteAwareConstExprStringNode:: DOUBLE_QUOTED ),
485485 false ,
486486 new IdentifierTypeNode ('int ' )
487487 ),
@@ -491,7 +491,7 @@ public function provideParseData(): array
491491 'array{ \'a \': int} ' ,
492492 new ArrayShapeNode ([
493493 new ArrayShapeItemNode (
494- new ConstExprStringNode ('a ' ),
494+ new QuoteAwareConstExprStringNode ('a ' , QuoteAwareConstExprStringNode:: SINGLE_QUOTED ),
495495 false ,
496496 new IdentifierTypeNode ('int ' )
497497 ),
@@ -501,7 +501,7 @@ public function provideParseData(): array
501501 'array{ \'$ref \': int} ' ,
502502 new ArrayShapeNode ([
503503 new ArrayShapeItemNode (
504- new ConstExprStringNode ('$ref ' ),
504+ new QuoteAwareConstExprStringNode ('$ref ' , QuoteAwareConstExprStringNode:: SINGLE_QUOTED ),
505505 false ,
506506 new IdentifierTypeNode ('int ' )
507507 ),
@@ -511,7 +511,7 @@ public function provideParseData(): array
511511 'array{"$ref": int} ' ,
512512 new ArrayShapeNode ([
513513 new ArrayShapeItemNode (
514- new ConstExprStringNode ('$ref ' ),
514+ new QuoteAwareConstExprStringNode ('$ref ' , QuoteAwareConstExprStringNode:: DOUBLE_QUOTED ),
515515 false ,
516516 new IdentifierTypeNode ('int ' )
517517 ),
@@ -979,8 +979,8 @@ public function provideParseData(): array
979979 [
980980 "'foo'|'bar' " ,
981981 new UnionTypeNode ([
982- new ConstTypeNode (new ConstExprStringNode ('foo ' )),
983- new ConstTypeNode (new ConstExprStringNode ('bar ' )),
982+ new ConstTypeNode (new QuoteAwareConstExprStringNode ('foo ' , QuoteAwareConstExprStringNode:: SINGLE_QUOTED )),
983+ new ConstTypeNode (new QuoteAwareConstExprStringNode ('bar ' , QuoteAwareConstExprStringNode:: SINGLE_QUOTED )),
984984 ]),
985985 ],
986986 [
@@ -997,7 +997,7 @@ public function provideParseData(): array
997997 ],
998998 [
999999 '"bar" ' ,
1000- new ConstTypeNode (new ConstExprStringNode ('bar ' )),
1000+ new ConstTypeNode (new QuoteAwareConstExprStringNode ('bar ' , QuoteAwareConstExprStringNode:: DOUBLE_QUOTED )),
10011001 ],
10021002 [
10031003 'Foo::FOO_* ' ,
@@ -1035,7 +1035,7 @@ public function provideParseData(): array
10351035 [
10361036 '( "foo" | Foo::FOO_* ) ' ,
10371037 new UnionTypeNode ([
1038- new ConstTypeNode (new ConstExprStringNode ('foo ' )),
1038+ new ConstTypeNode (new QuoteAwareConstExprStringNode ('foo ' , QuoteAwareConstExprStringNode:: DOUBLE_QUOTED )),
10391039 new ConstTypeNode (new ConstFetchNode ('Foo ' , 'FOO_* ' )),
10401040 ]),
10411041 ],
@@ -1701,7 +1701,7 @@ public function provideParseData(): array
17011701 'object{"a": int} ' ,
17021702 new ObjectShapeNode ([
17031703 new ObjectShapeItemNode (
1704- new ConstExprStringNode ('a ' ),
1704+ new QuoteAwareConstExprStringNode ('a ' , QuoteAwareConstExprStringNode:: DOUBLE_QUOTED ),
17051705 false ,
17061706 new IdentifierTypeNode ('int ' )
17071707 ),
@@ -1711,7 +1711,7 @@ public function provideParseData(): array
17111711 'object{ \'a \': int} ' ,
17121712 new ObjectShapeNode ([
17131713 new ObjectShapeItemNode (
1714- new ConstExprStringNode ('a ' ),
1714+ new QuoteAwareConstExprStringNode ('a ' , QuoteAwareConstExprStringNode:: SINGLE_QUOTED ),
17151715 false ,
17161716 new IdentifierTypeNode ('int ' )
17171717 ),
@@ -1721,7 +1721,7 @@ public function provideParseData(): array
17211721 'object{ \'$ref \': int} ' ,
17221722 new ObjectShapeNode ([
17231723 new ObjectShapeItemNode (
1724- new ConstExprStringNode ('$ref ' ),
1724+ new QuoteAwareConstExprStringNode ('$ref ' , QuoteAwareConstExprStringNode:: SINGLE_QUOTED ),
17251725 false ,
17261726 new IdentifierTypeNode ('int ' )
17271727 ),
@@ -1731,7 +1731,7 @@ public function provideParseData(): array
17311731 'object{"$ref": int} ' ,
17321732 new ObjectShapeNode ([
17331733 new ObjectShapeItemNode (
1734- new ConstExprStringNode ('$ref ' ),
1734+ new QuoteAwareConstExprStringNode ('$ref ' , QuoteAwareConstExprStringNode:: DOUBLE_QUOTED ),
17351735 false ,
17361736 new IdentifierTypeNode ('int ' )
17371737 ),
0 commit comments