Skip to content

Add test cases for quote aware array/object keys #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading