Open superbiche opened 2 years ago
Thanks for the PR! I’m going to review it and give a more detailed answer once I’m at the workplace.
Very interesting approach! @superbiche I was working on similar functionality over at https://github.com/fumeapp/modeltyper What all is difference between ReflectionEnumBackedCase instead of using something like:
$enum = (new ReflectionEnum($enumClass));
$enum->getConstants()
I am still trying myself to figure out all the new reflection stuff for enums
@superbiche Why was PR abandoned? There is information?
@rollsover nope, it's waiting for a review by the maintainer
@lepikhinb need review
@superbiche can you remove the "draft" mark and put a reviewer?
@rollsover nope, I can't add a reviewer and there's still some work left like writing tests & docs. I'd like to get a review first before spending time on tests and documentation. But feel free to review it too!
+1
This is an early PR to open a discussion on the following improvements (see #3):
enum
s for these Enums so we can use those during runtime (Enum must implement a newModelEnum
interface to be picked)Attribute
-based accessorsOutputModifiers
to create a pipeline of modifiers that will change the generated content before its written to a fileWhat must be done before merging it:
What would be nice to have, but can totally be done later:
phpClasses()
/phpEnums
)AbstractGenerator
so it's less coupled to classes and also allows enumsEnum
suffix, make it configurableEnumArray
suffix, make it configurableThis is a "quick and dirty" implementation that was written on the go for a project I'm working on, but it works quite well - right now we can use the generated typings as-is without modifying those manually.
It does need some polishing before merging it.
Also I've copied the files from what I've written by hand so there may be a few typos, missing
use
statements...I just wanted to publish it as soon as possible to collect feedback, and take some time the next weekend to polish it accordingly.
Thanks in advance for your feedback :)