From 6cb76c30770513f0e4b991bb31f56136ccdf3575 Mon Sep 17 00:00:00 2001 From: Audrius Date: Sun, 6 Sep 2026 09:13:32 +0200 Subject: [PATCH] Type the module translator example against the interface The container decides which translator a module receives and the debug environment decorates it, so the example's Translator type hint made a class that follows the documentation work with debug off and fail with it on. The unqualified name also resolved to nothing in a module namespace, and the assignment was missing its semicolon. --- modules/creation/module-translation/new-system.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/creation/module-translation/new-system.md b/modules/creation/module-translation/new-system.md index 3f1353bc03..d37e1dd2ab 100644 --- a/modules/creation/module-translation/new-system.md +++ b/modules/creation/module-translation/new-system.md @@ -184,15 +184,19 @@ class SomeAdminController extends PrestaShopAdminController Other classes will need to retrieve the module's translator instance somehow. We recommend passing it as a parameter in the constructor and storing it for later use. +Type the parameter as `PrestaShopBundle\Translation\TranslatorInterface`, not as any of the concrete translator classes: the container decides which implementation the module receives and the debug environment decorates it, so naming a concrete class makes the module work in one environment and fail in the other. + ```php translator = $translator + $this->translator = $translator; } public function foo()