Open MusikAnimal opened 5 years ago
Sounds good to me.
Do you mean that the Twig functions & filters would still be defined in Wikimedia\ToolforgeBundle\Twig\Extension
but that they'd just be wrappers for methods in Wikimedia\ToolforgeBundle\Service\Intuition
?
Oh oops yeah that's what you wrote. :) I should read before typing.
What bit is not working for type-hinting with the Intuition class? It seems to be working fine for me.
What bit is not working for type-hinting with the Intuition class? It seems to be working fine for me.
XTools' Twig extension type-hints the i18nHelper. I simply changed this to type-hint ToolforgeBundle\Service\Intuition and got the "no such service exists" error. It does know about Krinkle\Intuition, though.
All the nifty i18n-related helpers in Twig\Extension could be moved to Wikimedia\ToolforgeBundle\Service\Intuition. This way I can for instance use
msgIfExists()
in my PHP code. The Twig helpers can instead simply call the methods in Service\Intuition.Also, I'm not sure how Wikimedia\ToolforgeBundle\Service\Intuition works, but it would seem I can't type-hint it and use the Krinkle\Intuition methods, even though it extends Krinkle\Intuition. Maybe it's not registered as a public service?
This is the one barrier keeping XTools from using ToolforgeBundle. See i18nHelper for it's implementation (basically verbatim the same as ToolforgeBundle's Twig\Extension, except in a public service).