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 | * @var string |
||
37 | */ |
||
38 | private $applicationRootDirectory; |
||
39 | |||
40 | /** |
||
41 | * @param Parser $yamlReader |
||
42 | * @param ConfigBuilder $configBuilder |
||
43 | * @param string $applicationRootDirectory |
||
44 | */ |
||
45 | public function __construct(Parser $yamlReader, ConfigBuilder $configBuilder, string $applicationRootDirectory) |
||
51 | |||
52 | /** |
||
53 | * @inheritdoc |
||
54 | */ |
||
55 | public function isSupported(string $file): bool |
||
59 | |||
60 | /** |
||
61 | * @inheritdoc |
||
62 | */ |
||
63 | public function load(string $file, array $params): Config |
||
87 | |||
88 | /** |
||
89 | * @param string $file |
||
90 | * @param array $rawConfigData |
||
91 | */ |
||
92 | private function setConfigData(string $file, array $rawConfigData) |
||
110 | |||
111 | /** |
||
112 | * @param string $key |
||
113 | * @param array $rawConfig |
||
114 | * @param bool $default |
||
115 | * @return mixed|null |
||
116 | */ |
||
117 | private function extractData(string $key, array $rawConfig, $default = false) |
||
125 | |||
126 | /** |
||
127 | * @param string $file |
||
128 | * @return string |
||
129 | */ |
||
130 | private function loadFileContents(string $file): string |
||
134 | |||
135 | /** |
||
136 | * @param string $contents |
||
137 | * @return array |
||
138 | */ |
||
139 | private function parseFileContents(string $contents): array |
||
143 | |||
144 | /** |
||
145 | * @param string $file |
||
146 | * @param $rawConfigData |
||
147 | * @return array |
||
148 | */ |
||
149 | private function extractCommandPaths(string $file, array $rawConfigData): array |
||
157 | |||
158 | /** |
||
159 | * @param string $file |
||
160 | * @param array $rawConfigData |
||
161 | * @return array |
||
162 | */ |
||
163 | private function extractTemplates(string $file, array $rawConfigData): array |
||
174 | |||
175 | /** |
||
176 | * @param string $absoluteOrRelativePath |
||
177 | * @param string $baseFile |
||
178 | * @return string |
||
179 | * @throws \InvalidArgumentException |
||
180 | */ |
||
181 | private function fixPath(string $absoluteOrRelativePath, string $baseFile): string |
||
201 | |||
202 | /** |
||
203 | * @param string $baseFile |
||
204 | * @param string $path |
||
205 | * @return string |
||
206 | */ |
||
207 | private function makeAbsolutePath(string $baseFile, string $path): string |
||
211 | } |
||
212 |
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: