martin-helmich / php-schema2class

Generate PHP classes from JSON schemas
MIT License
30 stars 14 forks source link

EnumGenerator is immutable #117

Open simivar opened 5 days ago

simivar commented 5 days ago

We are currently facing an issue with the EnumGenerator from the Laminas package. This is the only generator that is immutable and, as a result, it causes challenges when using the onEnumCreated hook. To modify any of the properties one is required to use Reflection

To address this, we propose introducing our own EnumGenerator based on the amazing nikic/PHP-Parser package. The benefits of doing this are:

  1. we can gain greater control and flexibility over the generator
  2. we can add almost any statement to the generated enum
  3. we can provide the end user with more customizability

What do you think?

simivar commented 3 days ago

A draft solution proposition is vailable in #120. @martin-helmich I saw you did some changes to Enum generation, so some more of them here ;)