-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: add support for Enum casts, Attribute-based accessors, Output Modifiers #14
base: master
Are you sure you want to change the base?
feat: add support for Enum casts, Attribute-based accessors, Output Modifiers #14
Conversation
0e8e870
to
c4bb775
Compare
Thanks for the PR! I’m going to review it and give a more detailed answer once I’m at the workplace. |
c4bb775
to
5ed0fdc
Compare
Very interesting approach! @superbiche I was working on similar functionality over at https://github.com/fumeapp/modeltyper $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 :)