1 | <?php namespace Limoncello\Application\Packages\L10n; |
||
27 | abstract class L10nSettings implements SettingsInterface |
||
28 | { |
||
29 | /** Settings key */ |
||
30 | const KEY_DEFAULT_LOCALE = 0; |
||
31 | |||
32 | /** Settings key */ |
||
33 | const KEY_LOCALES_FOLDER = self::KEY_DEFAULT_LOCALE + 1; |
||
34 | |||
35 | /** Settings key */ |
||
36 | const KEY_LOCALES_DATA = self::KEY_LOCALES_FOLDER + 1; |
||
37 | |||
38 | /** Settings key */ |
||
39 | protected const KEY_LAST = self::KEY_LOCALES_DATA; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | private $appConfig; |
||
45 | |||
46 | /** |
||
47 | * @inheritdoc |
||
48 | */ |
||
49 | 1 | final public function get(array $appConfig): array |
|
50 | { |
||
51 | 1 | $this->appConfig = $appConfig; |
|
52 | |||
53 | 1 | $defaults = $this->getSettings(); |
|
54 | |||
55 | 1 | $defaultLocale = $defaults[static::KEY_DEFAULT_LOCALE] ?? null; |
|
56 | 1 | assert(empty($defaultLocale) === false, "Invalid default locale `$defaultLocale`."); |
|
57 | |||
58 | 1 | $localesFolder = $defaults[static::KEY_LOCALES_FOLDER] ?? null; |
|
59 | 1 | assert( |
|
60 | 1 | $localesFolder !== null && empty(glob($localesFolder)) === false, |
|
61 | 1 | "Invalid Locales folder `$localesFolder`." |
|
62 | ); |
||
63 | |||
64 | 1 | $bundleEncoder = new FileBundleEncoder($this->getMessageDescriptionsFromProviders(), $localesFolder); |
|
|
|||
65 | |||
66 | return $defaults + [ |
||
67 | 1 | static::KEY_LOCALES_DATA => $bundleEncoder->getStorageData($defaultLocale), |
|
68 | ]; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return array |
||
73 | */ |
||
74 | 1 | protected function getSettings(): array |
|
80 | |||
81 | /** |
||
82 | * @return mixed |
||
83 | */ |
||
84 | 1 | protected function getAppConfig() |
|
88 | |||
89 | /** |
||
90 | * |
||
91 | * @return iterable |
||
92 | */ |
||
93 | 1 | private function getMessageDescriptionsFromProviders(): iterable |
|
105 | } |
||
106 |
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: