1 | <?php |
||
27 | abstract class AbstractConfig extends AbstractEntity implements |
||
28 | ConfigInterface, |
||
29 | ContainerInterface, |
||
30 | IteratorAggregate |
||
31 | { |
||
32 | const DEFAULT_SEPARATOR = '.'; |
||
33 | |||
34 | /** |
||
35 | * Default separator for config is "." |
||
36 | * @var string $separator |
||
37 | */ |
||
38 | protected $separator = self::DEFAULT_SEPARATOR; |
||
39 | |||
40 | /** |
||
41 | * Create the configuration. |
||
42 | * |
||
43 | * @param mixed $data Optional default data. Either a filename, an array, or a Config object. |
||
44 | * @param ConfigInterface[] $delegates An array of delegates (config) to set. |
||
45 | * @throws InvalidArgumentException If $data is invalid. |
||
46 | */ |
||
47 | final public function __construct($data = null, array $delegates = null) |
||
74 | |||
75 | /** |
||
76 | * Config gives public access to its separator. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function separator() |
||
84 | |||
85 | /** |
||
86 | * Add a configuration file. The file type is determined by its extension. |
||
87 | * |
||
88 | * Supported file types are `ini`, `json`, `php` |
||
89 | * |
||
90 | * @param string $filename A supported configuration file. |
||
91 | * @throws InvalidArgumentException If the file is invalid. |
||
92 | * @return AbstractConfig (Chainable) |
||
93 | */ |
||
94 | public function addFile($filename) |
||
102 | |||
103 | /** |
||
104 | * Load a configuration file. The file type is determined by its extension. |
||
105 | * |
||
106 | * Supported file types are `ini`, `json`, `php` |
||
107 | * |
||
108 | * @param string $filename A supported configuration file. |
||
109 | * @throws InvalidArgumentException If the filename is invalid. |
||
110 | * @return mixed The file content. |
||
111 | */ |
||
112 | public function loadFile($filename) |
||
141 | |||
142 | /** |
||
143 | * For each key, calls `set()`, which calls `offsetSet()` (from ArrayAccess). |
||
144 | * |
||
145 | * The provided `$data` can be a simple array or an object which implements `Traversable` |
||
146 | * (such as a `ConfigInterface` instance). |
||
147 | * |
||
148 | * @param array|Traversable $data The data to set. |
||
149 | * @return AbstractConfig Chainable |
||
150 | * @see self::set() |
||
151 | * @see self::offsetSet() |
||
152 | */ |
||
153 | public function merge($data) |
||
160 | |||
161 | /** |
||
162 | * A stub for when the default data is empty. |
||
163 | * |
||
164 | * Make sure to reimplement in children ConfigInterface classes if any default data should be set. |
||
165 | * |
||
166 | * @see ConfigInterface::defaults() |
||
167 | * @return array |
||
168 | */ |
||
169 | public function defaults() |
||
173 | |||
174 | /** |
||
175 | * IteratorAggregate > getIterator() |
||
176 | * |
||
177 | * @return ArrayIterator |
||
178 | */ |
||
179 | public function getIterator() |
||
183 | |||
184 | /** |
||
185 | * Add a `.ini` file to the configuration. |
||
186 | * |
||
187 | * @param string $filename A INI configuration file. |
||
188 | * @throws InvalidArgumentException If the file or invalid. |
||
189 | * @return AbstractConfig Chainable |
||
190 | */ |
||
191 | private function loadIniFile($filename) |
||
201 | |||
202 | /** |
||
203 | * Add a `.json` file to the configuration. |
||
204 | * |
||
205 | * @param string $filename A JSON configuration file. |
||
206 | * @throws InvalidArgumentException If the file or invalid. |
||
207 | * @return AbstractConfig Chainable |
||
208 | */ |
||
209 | private function loadJsonFile($filename) |
||
246 | |||
247 | /** |
||
248 | * Add a PHP file to the configuration |
||
249 | * |
||
250 | * @param string $filename A PHP configuration file. |
||
251 | * @return AbstractConfig Chainable |
||
252 | */ |
||
253 | private function loadPhpFile($filename) |
||
259 | |||
260 | /** |
||
261 | * Add a YAML file to the configuration |
||
262 | * |
||
263 | * @param string $filename A YAML configuration file. |
||
264 | * @return AbstractConfig Chainable |
||
265 | */ |
||
266 | private function loadYamlFile($filename) |
||
273 | } |
||
274 |
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: