1 | <?php declare(strict_types=1); |
||
11 | class YamlConfigFileLoader implements ConfigLoader |
||
12 | { |
||
13 | const KEY_HEADER = 'header'; |
||
14 | |||
15 | const KEY_DYNAMIC_VARIABLES = 'dynamic'; |
||
16 | |||
17 | const KEY_CONST_VARIABLES = 'const'; |
||
18 | |||
19 | const KEY_COMMAND_PATHS = 'paths'; |
||
20 | |||
21 | const KEY_ENVIRONMENTS = 'environments'; |
||
22 | |||
23 | const KEY_TEMPLATES = 'templates'; |
||
24 | |||
25 | /** |
||
26 | * @var Parser |
||
27 | */ |
||
28 | private $yamlReader; |
||
29 | |||
30 | /** |
||
31 | * @var ConfigBuilder |
||
32 | */ |
||
33 | private $configBuilder; |
||
34 | |||
35 | /** |
||
36 | * @param Parser $yamlReader |
||
37 | * @param ConfigBuilder $configBuilder |
||
38 | */ |
||
39 | public function __construct(Parser $yamlReader, ConfigBuilder $configBuilder) |
||
44 | |||
45 | /** |
||
46 | * @inheritdoc |
||
47 | */ |
||
48 | public function isSupported(string $file): bool |
||
53 | |||
54 | /** |
||
55 | * @param string $file |
||
56 | * @return string |
||
57 | */ |
||
58 | private function removeDistExtension(string $file): string |
||
67 | |||
68 | /** |
||
69 | * @inheritdoc |
||
70 | */ |
||
71 | public function load(array $files): Config |
||
95 | |||
96 | /** |
||
97 | * @param string $file |
||
98 | * @param array $rawConfigData |
||
99 | */ |
||
100 | private function setConfigData(string $file, array $rawConfigData) |
||
123 | |||
124 | /** |
||
125 | * @param string $key |
||
126 | * @param array $rawConfig |
||
127 | * @param bool $default |
||
128 | * @return mixed|null |
||
129 | */ |
||
130 | private function extractData(string $key, array $rawConfig, $default = false) |
||
138 | |||
139 | /** |
||
140 | * @param string $file |
||
141 | * @return string |
||
142 | */ |
||
143 | private function loadFileContents(string $file): string |
||
147 | |||
148 | /** |
||
149 | * @param string $contents |
||
150 | * @return array |
||
151 | */ |
||
152 | private function parseFileContents(string $contents): array |
||
156 | |||
157 | /** |
||
158 | * @param string $file |
||
159 | * @param $rawConfigData |
||
160 | * @return array |
||
161 | */ |
||
162 | private function extractCommandPaths(string $file, array $rawConfigData): array |
||
170 | |||
171 | /** |
||
172 | * @param string $absoluteOrRelativePath |
||
173 | * @param string $baseFile |
||
174 | * @return string |
||
175 | */ |
||
176 | private function fixPath(string $absoluteOrRelativePath, string $baseFile): string |
||
184 | } |
||
185 |
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: