1 | <?php |
||
9 | trait HasTranslations |
||
10 | { |
||
11 | /** |
||
12 | * @param string $key |
||
13 | * |
||
14 | * @return mixed |
||
15 | */ |
||
16 | public function getAttributeValue($key) |
||
24 | |||
25 | /** |
||
26 | * @param $key |
||
27 | * @param $value |
||
28 | * @return HasTranslations|void |
||
29 | */ |
||
30 | public function setAttribute($key, $value) |
||
46 | |||
47 | /** |
||
48 | * @param string $key |
||
49 | * @param string $locale |
||
50 | * |
||
51 | * @return mixed |
||
52 | */ |
||
53 | public function translate(string $key, string $locale = '') |
||
57 | |||
58 | /*** |
||
59 | * @param string $key |
||
60 | * @param string $locale |
||
61 | * |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function getTranslation(string $key, string $locale) |
||
78 | |||
79 | public function getTranslations($key) : array |
||
85 | |||
86 | /** |
||
87 | * @param string $key |
||
88 | * @param string $locale |
||
89 | * @param $value |
||
90 | * |
||
91 | * @return $this |
||
92 | */ |
||
93 | public function setTranslation(string $key, string $locale, $value) |
||
114 | |||
115 | /** |
||
116 | * @param string $key |
||
117 | * @param array $translations |
||
118 | * |
||
119 | * @return $this |
||
120 | */ |
||
121 | public function setTranslations(string $key, array $translations) |
||
131 | |||
132 | /** |
||
133 | * @param string $key |
||
134 | * @param string $locale |
||
135 | * |
||
136 | * @return $this |
||
137 | */ |
||
138 | public function forgetTranslation(string $key, string $locale) |
||
148 | |||
149 | public function getTranslatedLocales(string $key) : array |
||
153 | |||
154 | protected function isTranslatableAttribute(string $key) : bool |
||
158 | |||
159 | protected function guardAgainstUntranslatableAttribute(string $key) |
||
165 | |||
166 | protected function normalizeLocale(string $key, string $locale) : string |
||
178 | |||
179 | public function getTranslatableAttributes() : array |
||
185 | |||
186 | public function getCasts() : array |
||
193 | } |
||
194 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.