- Issue created by @mstrelan
- Merge request !90Issue #3534844: Update TranslationInterface instead of TranslationManager for... → (Open) created by Unnamed author
- heddn Nicaragua
Hmm, but TranslationManager actually is a combination of both TranslationInterface and TranslatorInterface. How should this be handled?
- 🇦🇺Australia mstrelan
@heddn that's a great point. I note that TranslationInterface has only one implementation (outside of tests) and that is the TranslationManager. So by using TranslationInterface you'll always be getting TranslationManager, unless another module provides another implementation. The other thing to look at is what methods are actually called. I can see only ::translate and ::formatPlural, both of which come from TranslationInterface, so we could happily receive an object that implements only TranslationInterface and not TranslatorInterface.
I haven't considered BC concerns though, I think it would be mostly fine because we're actually broadening the type in the base class. Even if subclasses are calling methods from TranslatorInterface, it will still work, but phpstan might complain.