1 | <?php |
||
16 | class Locale implements LocaleContract |
||
17 | { |
||
18 | /* ----------------------------------------------------------------- |
||
19 | | Properties |
||
20 | | ----------------------------------------------------------------- |
||
21 | */ |
||
22 | |||
23 | /** @var string */ |
||
24 | private $key = ''; |
||
25 | |||
26 | /** @var string */ |
||
27 | private $path = ''; |
||
28 | |||
29 | /** @var array */ |
||
30 | private $files = []; |
||
31 | |||
32 | /* ----------------------------------------------------------------- |
||
33 | | Constructor |
||
34 | | ----------------------------------------------------------------- |
||
35 | */ |
||
36 | |||
37 | /** |
||
38 | * Locale constructor. |
||
39 | * |
||
40 | * @param string $key |
||
41 | * @param string $path |
||
42 | * @param array $files |
||
43 | */ |
||
44 | 88 | public function __construct(string $key, string $path, array $files = []) |
|
50 | |||
51 | /* ----------------------------------------------------------------- |
||
52 | | Getters & Setters |
||
53 | | ----------------------------------------------------------------- |
||
54 | */ |
||
55 | |||
56 | /** |
||
57 | * Get the locale key. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 88 | public function getKey(): string |
|
65 | |||
66 | /** |
||
67 | * Get the locale translations path. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 36 | public function getPath(): string |
|
75 | |||
76 | /** |
||
77 | * Get locale translations. |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | 8 | public function getTranslations(): array |
|
82 | { |
||
83 | 8 | $translations = array_map(function ($file) { |
|
84 | 8 | return $file['content']; |
|
85 | 8 | }, $this->files); |
|
86 | |||
87 | 8 | return Arr::dot($translations); |
|
|
|||
88 | } |
||
89 | |||
90 | /* ----------------------------------------------------------------- |
||
91 | | Main Methods |
||
92 | | ----------------------------------------------------------------- |
||
93 | */ |
||
94 | |||
95 | /** |
||
96 | * Merge translations. |
||
97 | * |
||
98 | * @param \Arcanedev\LaravelLang\Contracts\Entities\Locale|null $locale |
||
99 | * @param array $ignored |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | 4 | public function mergeTranslations(LocaleContract $locale = null, array $ignored = []): array |
|
119 | } |
||
120 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: