1 | <?php |
||
91 | class Config |
||
92 | { |
||
93 | const ENV_ALL = 'all'; |
||
94 | |||
95 | const ENV_PROD = 'prod'; |
||
96 | |||
97 | const ENV_PREP = 'prep'; |
||
98 | |||
99 | const ENV_DEV = 'dev'; |
||
100 | |||
101 | const ENV_LOCAL = 'local'; |
||
102 | |||
103 | const RUNTIME_ALL = 0; |
||
104 | |||
105 | const RUNTIME_CONSOLE = 1; |
||
106 | |||
107 | const RUNTIME_WEB = 2; |
||
108 | |||
109 | /** |
||
110 | * Constructor |
||
111 | * |
||
112 | * @param string $id |
||
113 | * @param string $basePath |
||
114 | * @param array $applicationConfig |
||
115 | */ |
||
116 | public function __construct($id, $basePath, array $applicationConfig = []) |
||
122 | |||
123 | private $_env; |
||
124 | |||
125 | /** |
||
126 | * Assign the env to each component, module or application that defined inside the callback. |
||
127 | * |
||
128 | * Callback function has one parameter with the current {{luya\Config}} object. |
||
129 | * |
||
130 | * @param string $env The environment to assigne inside the callback. |
||
131 | * @param callable $callback function(\luya\Config $config) |
||
132 | * @return $this |
||
133 | */ |
||
134 | public function env($env, callable $callback) |
||
146 | |||
147 | /** |
||
148 | * register application level config |
||
149 | * |
||
150 | * @param array $config The array to configure |
||
151 | * @return ConfigDefinition |
||
152 | */ |
||
153 | public function application(array $config) |
||
157 | |||
158 | /** |
||
159 | * Register one or more bootstrap entries into the bootstrap section. |
||
160 | * |
||
161 | * @param array $config An array with bootstrap entries, its common to use the module name |
||
162 | * @return ConfigDefinition |
||
163 | */ |
||
164 | public function bootstrap(array $config) |
||
168 | |||
169 | /** |
||
170 | * Register a module. |
||
171 | * |
||
172 | * @param string $id The module identifier. |
||
173 | * @param string|array $config The configuration for the given module. If a string is given this will be taken as `class` property. |
||
174 | * @return ConfigDefinition |
||
175 | */ |
||
176 | public function module($id, $config) |
||
180 | |||
181 | public function callback(callable $fn) |
||
185 | |||
186 | /** |
||
187 | * Register a component |
||
188 | * |
||
189 | * @param string $id The id of the component |
||
190 | * @param string|array $config The configuration for the given module. If a string is given this will be taken as `class` property. |
||
191 | * @param string $runtime The runtime for the component: all, web or console |
||
192 | * @return ConfigDefinition |
||
193 | */ |
||
194 | public function component($id, $config, $runtime = self::RUNTIME_ALL) |
||
198 | |||
199 | /** |
||
200 | * Register a web runtime component. |
||
201 | * |
||
202 | * @param string $id The id of the component |
||
203 | * @param string|array $config The configuration for the given module. If a string is given this will be taken as `class` property. |
||
204 | * @return ConfigDefinition |
||
205 | */ |
||
206 | public function webComponent($id, $config) |
||
210 | |||
211 | /** |
||
212 | * Register a console runtime component. |
||
213 | * |
||
214 | * @param string $id The id of the component |
||
215 | * @param string|array $config The configuration for the given module. If a string is given this will be taken as `class` property. |
||
216 | * @return ConfigDefinition |
||
217 | */ |
||
218 | public function consoleComponent($id, $config) |
||
222 | |||
223 | private $_definitions = []; |
||
224 | |||
225 | /** |
||
226 | * Add a definition into the definitions bag. |
||
227 | * |
||
228 | * @param ConfigDefinition $definition |
||
229 | * @return ConfigDefinition |
||
230 | */ |
||
231 | private function addDefinition(ConfigDefinition $definition) |
||
241 | |||
242 | private $_isCliRuntime; |
||
243 | |||
244 | /** |
||
245 | * Whether runtime is cli or not |
||
246 | * |
||
247 | * @return boolean |
||
248 | */ |
||
249 | public function isCliRuntime() |
||
257 | |||
258 | /** |
||
259 | * Setter method for runtime. |
||
260 | * |
||
261 | * > This method is mainly used for unit testing. |
||
262 | * |
||
263 | * @param boolean $value |
||
264 | */ |
||
265 | public function setCliRuntime($value) |
||
269 | |||
270 | /** |
||
271 | * Export the given configuration as array for certain envs. |
||
272 | * |
||
273 | * @param array $envs A list of environments to export. if nothing is given all enviroments will be returned. |
||
274 | * @return array The configuration array |
||
275 | */ |
||
276 | public function toArray(array $envs = []) |
||
297 | |||
298 | /** |
||
299 | * Append a given definition int othe config |
||
300 | * |
||
301 | * @param array $config |
||
302 | * @param ConfigDefinition $definition |
||
303 | */ |
||
304 | private function appendConfig(&$config, ConfigDefinition $definition) |
||
334 | |||
335 | /** |
||
336 | * Add a array key based component definition. |
||
337 | * |
||
338 | * @param array $config |
||
339 | * @param ConfigDefinition $definition |
||
340 | * @param string $section |
||
341 | */ |
||
342 | private function handleKeyBaseMerge(&$config, ConfigDefinition $definition, $section) |
||
356 | } |
||
357 |
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: