1 | <?php |
||
24 | final class EditInPlaceTranslator implements TranslatorInterface, TranslatorBagInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var TranslatorInterface|\Symfony\Component\Translation\Translator |
||
28 | */ |
||
29 | private $translator; |
||
30 | |||
31 | /** |
||
32 | * @var ActivatorInterface |
||
33 | */ |
||
34 | private $activator; |
||
35 | |||
36 | /** |
||
37 | * @var RequestStack |
||
38 | */ |
||
39 | private $requestStack; |
||
40 | |||
41 | 3 | public function __construct(TranslatorInterface $translator, ActivatorInterface $activator, RequestStack $requestStack) |
|
47 | |||
48 | /** |
||
49 | * @see Translator::getCatalogue |
||
50 | */ |
||
51 | public function getCatalogue($locale = null) |
||
55 | |||
56 | /** |
||
57 | * @see Translator::trans |
||
58 | */ |
||
59 | 3 | public function trans($id, array $parameters = [], $domain = null, $locale = null) |
|
86 | |||
87 | /** |
||
88 | * @see Translator::trans |
||
89 | */ |
||
90 | public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) |
||
91 | { |
||
92 | if (!$this->activator->checkRequest($this->requestStack->getMasterRequest())) { |
||
93 | return $this->translator->transChoice($id, $number, $parameters, $domain, $locale); |
||
94 | } |
||
95 | |||
96 | $parameters = array_merge([ |
||
97 | '%count%' => $number, |
||
98 | ], $parameters); |
||
99 | |||
100 | return $this->trans($id, $parameters, $domain, $locale); |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @see Translator::trans |
||
105 | */ |
||
106 | public function setLocale($locale) |
||
110 | |||
111 | /** |
||
112 | * @see Translator::trans |
||
113 | */ |
||
114 | public function getLocale() |
||
118 | } |
||
119 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: