nette / php-generator

🐘 Generates neat PHP code for you. Supports new PHP 8.3 features.
https://doc.nette.org/php-generator
Other
2.11k stars 138 forks source link

Test to reproduce #143 #144

Closed kynx closed 11 months ago

kynx commented 12 months ago

This PR adds a test to reproduce #143. Not sure if I'm asserting the right thing, but I'll update it if I can figure out a fix.

kynx commented 12 months ago

Actually I have no idea what should be done here.

Maybe detect if the array contains and keys with an Identifier for a name and then return a Literal() for the whole thing, like It did before 4.1.1? That seems kind of kludgy, but it is what I have to do when generating these arrays. @dg any suggestions?

kynx commented 11 months ago

@dg I don't know what to do here. That commit is a major BC break for me. Should I revert the whole thing or are there bits that don't break stuff for people?

It would be lovely if this library could actually handle identifiers as array keys. Maybe I could help with that, given a general plan of action for the a next major. But right now I can no longer round trip classes generated with this library. It needs fixing.

dg commented 11 months ago

Probably the best way, given backwards compatibility, is to just return the whole array as Literal, the way it used to work…

kynx commented 11 months ago

👍 Many thanks for that!