1 | <?php |
||
18 | class Translate |
||
19 | { |
||
20 | |||
21 | protected $cached = []; |
||
22 | protected $indexes = []; |
||
23 | |||
24 | /** |
||
25 | * Translate constructor. Load default translations. |
||
26 | */ |
||
27 | public function __construct() |
||
34 | |||
35 | |||
36 | /** |
||
37 | * Get internalization of current text from i18n |
||
38 | * @param string $index |
||
39 | * @param string $text |
||
40 | * @param array|null $params |
||
41 | * @return string |
||
42 | */ |
||
43 | public function get($index, $text, array $params = null) |
||
63 | |||
64 | /** |
||
65 | * Get internalization based on called controller |
||
66 | * @param string $text |
||
67 | * @param array $params |
||
68 | * @return string |
||
69 | */ |
||
70 | public function translate($text, array $params = []) |
||
81 | |||
82 | /** |
||
83 | * Load locale file from local storage |
||
84 | * @param string $index |
||
85 | * @return array|null |
||
86 | */ |
||
87 | protected function load($index) |
||
95 | |||
96 | /** |
||
97 | * Append translation data from exist full path |
||
98 | * @param string $path |
||
99 | * @return bool |
||
100 | */ |
||
101 | public function append($path) |
||
119 | |||
120 | /** |
||
121 | * Get available languages in the filesystem |
||
122 | * @return array |
||
123 | */ |
||
124 | public function getAvailableLangs() |
||
133 | |||
134 | /** |
||
135 | * Get locale data from input array or serialized string |
||
136 | * @param array|string $input |
||
137 | * @param string|null $lang |
||
138 | * @param string|null $default |
||
139 | * @return string|null |
||
140 | */ |
||
141 | public function getLocaleText($input, $lang = null, $default = null) |
||
158 | } |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.