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 MessageCatalogue[] Fetched catalogies |
||
46 | */ |
||
47 | private $catalogues; |
||
48 | |||
49 | /** |
||
50 | * @param TranslationWriter $writer |
||
51 | * @param SymfonyTranslationLoader|TranslationLoader $loader |
||
52 | * @param array $dir |
||
53 | */ |
||
54 | 3 | public function __construct(TranslationWriter $writer, $loader, array $dir) |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | public function get($locale, $domain, $key) |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | */ |
||
83 | public function create(Message $m) |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | public function update(Message $m) |
||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | public function delete($locale, $domain, $key) |
||
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | */ |
||
118 | public function export(MessageCatalogueInterface $catalogue) |
||
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | public function import(MessageCatalogueInterface $catalogue) |
||
134 | |||
135 | /** |
||
136 | * Save catalogue back to file. |
||
137 | * |
||
138 | * @param MessageCatalogue $catalogue |
||
139 | * @param string $domain |
||
140 | */ |
||
141 | private function writeCatalogue(MessageCatalogue $catalogue, $locale, $domain) |
||
151 | |||
152 | /** |
||
153 | * @param string $locale |
||
154 | * |
||
155 | * @return MessageCatalogue |
||
156 | */ |
||
157 | private function getCatalogue($locale) |
||
165 | |||
166 | /** |
||
167 | * Load catalogue from files. |
||
168 | * |
||
169 | * @param string $locale |
||
170 | * @param array $dirs |
||
171 | */ |
||
172 | private function loadCatalogue($locale, array $dirs) |
||
183 | } |
||
184 |
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.