bangpound / callable-compiler-pass

Define a compiler pass with a callable instead of a class.
6 stars 1 forks source link

Ever considered PRing to core? #1

Open jenkoian opened 8 years ago

jenkoian commented 8 years ago

Hey, this looks really useful, particularly when using MicroKernel, you ever considered submitting a PR into core?

bangpound commented 8 years ago

I hadn't considered it! Are you using it?

jenkoian commented 8 years ago

I am yeah, it's useful when using the micro kernel. I reckon it'd be worth a PR to core if you fancy it. It may be deemed not worth it (it's only a small thing I guess) but would get my +1.

Richtermeister commented 8 years ago

Just to add to this conversation, core recently introduced something similar: http://symfony.com/blog/new-in-symfony-2-8-dependencyinjection-improvements#simplified-registering-of-compiler-passes

jenkoian commented 8 years ago

Thanks @Richtermeister I mentioned it briefly on https://github.com/bangpound/callable-compiler-pass/pull/2#issue-139889093 but yeah think you're right.

Although as this callable pass is more for the Micro Kernel, where you want to keep everything in a single file to get going quickly, I think there's space for both. I guess you could do the same with the new thing by declaring a class just below your AppKernel in the same file, or if you're lucky enough to be using PHP7 an anonymous class implementing the interface, but I think a callable is a bit neater.

Whether worth going into core or not in light of that recent change though I'm not sure. ¯(ツ)