phpstan / phpdoc-parser

Next-gen phpDoc parser with support for intersection types and generics
MIT License
1.35k stars 61 forks source link

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

Closed ruudk closed 2 months ago

ruudk commented 2 months ago

See #251

ruudk commented 2 months ago

I agree. Will try it out

ruudk commented 2 months ago

I added the test cases and they work perfectly fine.

~That's interesting.~

~I think the issue is in PHPStan: https://github.com/phpstan/phpstan-src/blob/8fd91a40fa9064378b18a31c081663d6f54494e6/src/Type/Constant/ConstantArrayType.php#L1648-L1689~

~This never creates QuoteAwareConstExprStringNode.~

ruudk commented 2 months ago

I'm sorry for this, but the problem was that my TypeParser did not have $quoteAwareConstExprString enabled. While my ConstExprParser did. I didn't notice I had to configure it in 2 locations.

ruudk commented 2 months ago

Is there value in these 2 test cases? Or do we close the PR?

ondrejmirtes commented 2 months ago

Thank you!