Skip to content

Commit

Permalink
Add test cases for quote aware array/object keys
Browse files Browse the repository at this point in the history
See #251
  • Loading branch information
ruudk authored and ondrejmirtes committed Sep 8, 2024
1 parent 7e92a25 commit 1c7fcc4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/PHPStan/Printer/PrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,36 @@ public function dataPrintType(): iterable
),
'self::TYPES[int]',
];
yield [
new ArrayShapeNode([
new ArrayShapeItemNode(
new IdentifierTypeNode('name'),
false,
new IdentifierTypeNode('string')
),
new ArrayShapeItemNode(
new QuoteAwareConstExprStringNode('Full Name', QuoteAwareConstExprStringNode::SINGLE_QUOTED),
false,
new IdentifierTypeNode('string')
),
]),
"array{name: string, 'Full Name': string}",
];
yield [
new ObjectShapeNode([
new ObjectShapeItemNode(
new IdentifierTypeNode('name'),
false,
new IdentifierTypeNode('string')
),
new ObjectShapeItemNode(
new QuoteAwareConstExprStringNode('Full Name', QuoteAwareConstExprStringNode::SINGLE_QUOTED),
false,
new IdentifierTypeNode('string')
),
]),
"object{name: string, 'Full Name': string}",
];
}

/**
Expand Down

0 comments on commit 1c7fcc4

Please sign in to comment.