Closed cotcotquedec closed 7 years ago
Thanks a lot. I really like the bugfixes for reading classes from reflection, especially with parent classes, as I didn't cover them. What about interfaces and traits? Will they also inherit methods that are available through reflection? Could you check this situation, too and provide tests for reflection with parents?
Second, the php5.4 array syntax: I'm a bit wondering how you managed to achieve what you did. Probably because you don't know the separation of concerns of this lib (as they are in my mind ;). The most "suspicious" method I'm wondering about is the static export on PhpProperty
. Since values (and expressions are handled on the ValuePart
) there is now value
and expression
.
Here are some rules of the lib:
fromReflection
method but nowhere elseGeneratorVisitor
and nowhere elseThe Writer
is "dumb", means it only flushes what it is been told. You teached him some logic, which isn't the right place here. This should be in the GeneratorVisitor
and passing the right value to Writer
.
Arrays: Arrays in php are so tricky in how they can look. It's also too risky to have an algorithm to parse/write them, as there is always a case a user wants that isn't catched in the algorithm. That's why there is now setValue()
and setExpression()
. The first is almost always escaped (through var_export()
). However, if you want more control over your output, there is expression, which is never escaped, so you can pass code (especially useful for writing short php code statements and arrays as well, too).
So, could you rewrite your enhancements with this new knowledge? Please feel free to ask questions.
Hi, thank you for your answer,
I'm french so i have some trouble to fully understand everything but i try.
I use php-code-genertor to avoid copy-paste process and generated code using php-cli (in a laravel environenment at the time). So i always use it to add code or template of code inside an existing class and it's really important to not have regression of any kind (indentation and syntax included) after generation process.
For php 5.4 syntax, i agree that it's a personnal choice and it will be better to extend the generatoir with my preferences.
I'm not sure to answer your questions!!!
I made some fix every day on, how do you wanna proceed? i can make a branch for every patch and make a pull request?
Best regards,
If you want, you can find the very early alpha of my project here https://github.com/FrenchFrogs/maker
This can be closed as all the issues are being resolved with version 0.4.
…and traits management from extended class, add export methods for write array a php 5.4 syntax