1 | <?php |
||
23 | class Translator implements TranslatorInterface, TranslatorBagInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var TranslatorInterface|\Symfony\Component\Translation\Translator |
||
27 | */ |
||
28 | private $translator; |
||
29 | |||
30 | /** |
||
31 | * @var ActivatorInterface |
||
32 | */ |
||
33 | private $activator; |
||
34 | |||
35 | /** |
||
36 | * @var RequestStack |
||
37 | */ |
||
38 | private $requestStack; |
||
39 | |||
40 | public function __construct(TranslatorInterface $translator, ActivatorInterface $activator, RequestStack $requestStack) |
||
46 | |||
47 | /** |
||
48 | * @see Translator::getCatalogue |
||
49 | */ |
||
50 | public function getCatalogue($locale = null) |
||
54 | |||
55 | /** |
||
56 | * @see Translator::trans |
||
57 | */ |
||
58 | public function trans($id, array $parameters = [], $domain = null, $locale = null) |
||
77 | |||
78 | /** |
||
79 | * @see Translator::trans |
||
80 | */ |
||
81 | public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) |
||
93 | |||
94 | /** |
||
95 | * @see Translator::trans |
||
96 | */ |
||
97 | public function setLocale($locale) |
||
101 | |||
102 | /** |
||
103 | * @see Translator::trans |
||
104 | */ |
||
105 | public function getLocale() |
||
109 | } |
||
110 |
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: