Add tuple generator
Hello 😄 I prepared my proposal of Tuples with generics, as discussed in here https://github.com/munusphp/munus/issues/38 It's just proposal, still in progress, there is no tests yet.
I started by just coding this classes manually, but making them manually without mistakes is hard, and laborious. So following vavr's approach, I built a template with command that generates the code of the Tuples. I'm not 100% contented by this solution, but that's the fastest and lightest solution that came to my mind.
I'm also wondering about using library like https://github.com/nette/php-generator. I could install it as a dev dependency and use it to generating the code in object oriented way, and it could be more readable maybe 🤔
@akondas What do you think about that?
I've replaced it with better implementation using nette/php-generator. It works ways better in my opinion. There is a test that is testing first 3 classes of Tuples by comparing strings, but I wrote them only in development purpose. In final implementation that doesn't make sense to keep them. Better will be to test only their behaviors and php-cs-fixer will check the code style. It's still in progress and require a lot of refactoring.
Todo:
- [x] Make some maintenance on master branch, do decrease size of PR https://github.com/munusphp/munus/pull/77
- [x] More test coverage for TupleN classes
- [x] Generator command CI checker, to avoid manual changes in generated classes
Ok, I belive I'm done. ~1300 lines of the PR is generated automatically, but it's still quite big, sorry for that 😄
I've added validation command to composer tests which is validating if existing Tuples has been generated by latest version of generator.
I covered Tuples in 100% in tests what I believe is quite important for generated classes.
looks cool, are you happy to rebase and wait for php 8.2 upgarde?
looks cool, are you happy to rebase and wait for php 8.2 upgarde?
Yes, thank you! 😄
I've refactored generate command a little bit. Right now it's a single command to validate and generate and it shows diff if validation fails:
Hey @mtk3d, Is there anything left to do here, because I would like to give it a chance, it's a big PR and I think it would be a pity to leave it open :)
Hi @mtk3d, ping again, If you don't have time right now, I can fix the changes after rebase and do a merge.
Closes #38
Thanks @mtk3d :beers:
Hey @akondas sorry for not responding I had an apartment renovation and it totally consumed all my free time and energy Thanks for merge 🍻