cg-library
cg-library copied to clipboard
Extended cg lib: Traits and Interface support
Hey,
I needed a good codegen lib with traits and interface support. Your codegen lib was the best I found, though missing what I needed. I baked it in. All changes:
- requires php 5.4
- New Model, heavily composed from various traits
- Docblock Model, based on phpDocumentor/ReflectionDocBlock
- More metadata for all models -> docblock generation from models
- New CodeGenerator class, that recursively generates docblock before code generation
- Some API changes, so incompatible with the current version
- Needs an update to a new major version (see below)
- Uhm, I have a different code style, so at best the code should be run through a code formatter
I would suggest a new name, because the library is hardly findable. New and better name probably is: php-code-generator
or php-codegen
. Because a new version is needed, I think this fits perfectly with a new name. How actively maintained is this project for this?
I will use my fork for my current project. I think I will find another round of issues when using it from a particular project. At least in the early days.
In a perfect world:
- Code from a file -> generate the model through reflection and regenerate the code again -> still is the same [still not the case]
- At best, a code formatter is run after code generation to properly deal with issues (e.g. indentation in code blocks). I started one as a nightly experiment: gossi/php-code-formatter (still is a bigger project than a nightly experiment :smile:)
Would love to hear feedback gossi
I always find it weird to see a PR beign opened rewriting a library entirely without any previous discussion on it to know what the maintainer thinks about it...
Note that I'm not the maintainer
Hum, ye rewrite somehow sounds weird. It's more an extension that I needed and pushed back now.
Well, if it is not BC (and it is not as it removes the 5.3 support for instance and drops some classes), it is not just an extension.
Any news on this @schmittjoh ? Because I'm planning on releasing my fork as its own version. Thanks.