CompilerExtension and easier way to add code to the initialize method
- David Grudl
- Nette Core | 8253
I am thinking (in fact it is implemented in nette/di @dev) about this feature. I think code will be enough instead of words:
Before:
After:
Advantages:
- simple syntax
- can be used everywhere (in loadConfiguration(), …)
- generates the initialize() method in more safe and readable form:
- Toanir
- Member | 57
Hi,
I like how neat usage gets this way, that's a definitive ++. The generated code looks a bit funny to me because of those IIFEs. Since those are already function calls, would it make sense to create actual functions for each module? The modules are named so we could have something like
As far as my understanding of PHP goes, these should be equivalent, and they are only a bit easier to the human eye, should one have the need to debug output of their extension.