1 | <?php |
||
25 | class ConfigurationLoader |
||
26 | { |
||
27 | /** |
||
28 | * Config passed in the constructor |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $_initialConfig; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $_configArray = null; |
||
38 | |||
39 | /** |
||
40 | * Cache |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $_distConfig; |
||
45 | |||
46 | /** |
||
47 | * Cache |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $_pluginConfig; |
||
52 | |||
53 | /** |
||
54 | * Cache |
||
55 | * |
||
56 | * @var array |
||
57 | */ |
||
58 | protected $_systemConfig; |
||
59 | |||
60 | /** |
||
61 | * Cache |
||
62 | * |
||
63 | * @var array |
||
64 | */ |
||
65 | protected $_userConfig; |
||
66 | |||
67 | /** |
||
68 | * Cache |
||
69 | * |
||
70 | * @var array |
||
71 | */ |
||
72 | protected $_projectConfig; |
||
73 | |||
74 | /** |
||
75 | * @var string |
||
76 | */ |
||
77 | protected $_customConfigFilename = 'n98-magerun.yaml'; |
||
78 | |||
79 | /** |
||
80 | * @var bool |
||
81 | */ |
||
82 | protected $_isPharMode = true; |
||
83 | |||
84 | /** |
||
85 | * @var OutputInterface |
||
86 | */ |
||
87 | protected $_output; |
||
88 | |||
89 | /** |
||
90 | * Load config |
||
91 | * If $magentoRootFolder is null, only non-project config is loaded |
||
92 | * |
||
93 | * @param array $config |
||
94 | * @param bool $isPharMode |
||
95 | * @param OutputInterface $output |
||
96 | */ |
||
97 | public function __construct(array $config, $isPharMode, OutputInterface $output) |
||
103 | |||
104 | /** |
||
105 | * @param bool $loadExternalConfig |
||
106 | * @return array |
||
107 | */ |
||
108 | public function getPartialConfig($loadExternalConfig = true) |
||
119 | |||
120 | /** |
||
121 | * @param string $magentoRootFolder |
||
122 | * @param bool $loadExternalConfig |
||
123 | * @param string $magerunStopFileFolder |
||
124 | */ |
||
125 | public function loadStageTwo($magentoRootFolder, $loadExternalConfig = true, $magerunStopFileFolder = '') |
||
137 | |||
138 | /** |
||
139 | * @throws \ErrorException |
||
140 | * |
||
141 | * @return array |
||
142 | */ |
||
143 | public function toArray() |
||
151 | |||
152 | /** |
||
153 | * @param array $initConfig |
||
154 | * |
||
155 | * @return array |
||
156 | */ |
||
157 | protected function loadDistConfig(array $initConfig) |
||
171 | |||
172 | /** |
||
173 | * Check if there is a global config file in /etc folder |
||
174 | * |
||
175 | * @param array $config |
||
176 | * |
||
177 | * @return array |
||
178 | */ |
||
179 | public function loadSystemConfig(array $config) |
||
200 | |||
201 | /** |
||
202 | * Load config from all installed bundles |
||
203 | * |
||
204 | * @param array $config |
||
205 | * @param string $magentoRootFolder |
||
206 | * |
||
207 | * @return array |
||
208 | */ |
||
209 | public function loadPluginConfig(array $config, $magentoRootFolder) |
||
236 | |||
237 | /** |
||
238 | * @param string $magentoRootFolder |
||
239 | * @param string|array $in |
||
240 | * @param integer $depth |
||
241 | */ |
||
242 | private function traversePluginFoldersForConfigFile($magentoRootFolder, $in, $depth) |
||
261 | |||
262 | /** |
||
263 | * Check if there is a user config file. ~/.n98-magerun.yaml |
||
264 | * |
||
265 | * @param array $config |
||
266 | * @param string $magentoRootFolder [optional] |
||
267 | * |
||
268 | * @return array |
||
269 | */ |
||
270 | public function loadUserConfig(array $config, $magentoRootFolder = null) |
||
284 | |||
285 | /** |
||
286 | * MAGENTO_ROOT/app/etc/n98-magerun.yaml |
||
287 | * |
||
288 | * @param string $magentoRootFolder |
||
289 | * @param string $magerunStopFileFolder |
||
290 | * @param array $config |
||
291 | * |
||
292 | * @return array |
||
293 | */ |
||
294 | public function loadProjectConfig($magentoRootFolder, $magerunStopFileFolder, array $config) |
||
314 | |||
315 | /** |
||
316 | * Loads a plugin config file and merges it to plugin config |
||
317 | * |
||
318 | * @param string $magentoRootFolder |
||
319 | * @param SplFileInfo $file |
||
320 | */ |
||
321 | protected function registerPluginConfigFile($magentoRootFolder, $file) |
||
330 | |||
331 | /** |
||
332 | * @return string |
||
333 | */ |
||
334 | public function getVendorDir() |
||
352 | |||
353 | /** |
||
354 | * @return string |
||
355 | */ |
||
356 | public function getConfigurationLoaderDir() |
||
360 | |||
361 | /** |
||
362 | * @param string $message |
||
363 | */ |
||
364 | private function logDebug($message) |
||
370 | |||
371 | /** |
||
372 | * @param string $message |
||
373 | */ |
||
374 | private function log($message) |
||
378 | } |
||
379 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.