1 | <?php |
||
27 | final class FileStorage implements Storage, TransferableStorage |
||
28 | { |
||
29 | /** |
||
30 | * @var TranslationWriter |
||
31 | */ |
||
32 | private $writer; |
||
33 | |||
34 | /** |
||
35 | * @var TranslationLoader|SymfonyTranslationLoader |
||
36 | */ |
||
37 | private $loader; |
||
38 | |||
39 | /** |
||
40 | * @var array directory path |
||
41 | */ |
||
42 | private $dir; |
||
43 | |||
44 | /** |
||
45 | * @var array with option to the dumper |
||
46 | */ |
||
47 | private $options; |
||
48 | |||
49 | /** |
||
50 | * @var MessageCatalogue[] Fetched catalogies |
||
51 | */ |
||
52 | private $catalogues; |
||
53 | |||
54 | /** |
||
55 | * @param TranslationWriter $writer |
||
56 | * @param SymfonyTranslationLoader|TranslationLoader $loader |
||
57 | * @param array $dir |
||
58 | * @param array $options |
||
59 | */ |
||
60 | 10 | public function __construct(TranslationWriter $writer, $loader, array $dir, array $options = []) |
|
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | 1 | public function get($locale, $domain, $key) |
|
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | 2 | public function create(Message $m) |
|
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | 1 | public function update(Message $m) |
|
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | 1 | public function delete($locale, $domain, $key) |
|
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | 1 | public function export(MessageCatalogueInterface $catalogue) |
|
130 | |||
131 | /** |
||
132 | * {@inheritdoc} |
||
133 | */ |
||
134 | 1 | public function import(MessageCatalogueInterface $catalogue) |
|
141 | |||
142 | /** |
||
143 | * Save catalogue back to file. |
||
144 | * |
||
145 | * @param MessageCatalogue $catalogue |
||
146 | * @param string $domain |
||
147 | */ |
||
148 | 5 | private function writeCatalogue(MessageCatalogue $catalogue, $locale, $domain) |
|
171 | |||
172 | /** |
||
173 | * @param string $locale |
||
174 | * |
||
175 | * @return MessageCatalogue |
||
176 | */ |
||
177 | 6 | private function getCatalogue($locale) |
|
185 | |||
186 | /** |
||
187 | * Load catalogue from files. |
||
188 | * |
||
189 | * @param string $locale |
||
190 | * @param array $dirs |
||
191 | */ |
||
192 | 6 | private function loadCatalogue($locale, array $dirs) |
|
203 | } |
||
204 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.