1 | <?php |
||
24 | trait TranslatableTrait |
||
25 | { |
||
26 | /** |
||
27 | * @var ArrayCollection|PersistentCollection|TranslationInterface[] |
||
28 | */ |
||
29 | protected $translations; |
||
30 | |||
31 | /** |
||
32 | * @var array|TranslationInterface[] |
||
33 | */ |
||
34 | protected $translationsCache = []; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $currentLocale; |
||
40 | |||
41 | /** |
||
42 | * Cache current translation. Useful in Doctrine 2.4+ |
||
43 | * |
||
44 | * @var TranslationInterface |
||
45 | */ |
||
46 | protected $currentTranslation; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $fallbackLocale; |
||
52 | |||
53 | public function __construct() |
||
57 | |||
58 | /** |
||
59 | * @param string $locale |
||
|
|||
60 | * |
||
61 | * @return TranslationInterface |
||
62 | */ |
||
63 | public function getTranslation($locale = null) |
||
103 | |||
104 | /** |
||
105 | * @return TranslationInterface[] |
||
106 | */ |
||
107 | public function getTranslations() |
||
111 | |||
112 | /** |
||
113 | * @param TranslationInterface $translation |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | public function hasTranslation(TranslationInterface $translation) |
||
121 | |||
122 | /** |
||
123 | * @param TranslationInterface $translation |
||
124 | */ |
||
125 | public function addTranslation(TranslationInterface $translation) |
||
134 | |||
135 | /** |
||
136 | * @param TranslationInterface $translation |
||
137 | */ |
||
138 | public function removeTranslation(TranslationInterface $translation) |
||
146 | |||
147 | /** |
||
148 | * @param string $currentLocale |
||
149 | */ |
||
150 | public function setCurrentLocale($currentLocale) |
||
154 | |||
155 | /** |
||
156 | * @param string $fallbackLocale |
||
157 | */ |
||
158 | public function setFallbackLocale($fallbackLocale) |
||
162 | |||
163 | /** |
||
164 | * Create resource translation model. |
||
165 | * |
||
166 | * @return TranslationInterface |
||
167 | */ |
||
168 | abstract protected function createTranslation(); |
||
169 | } |
||
170 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.