1 | <?php |
||
19 | class Container implements ContainerInterface |
||
20 | { |
||
21 | /** |
||
22 | * Array of singletons |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $services = []; |
||
26 | |||
27 | /** |
||
28 | * Array of Definitions |
||
29 | * |
||
30 | * @var Definition[] |
||
31 | */ |
||
32 | protected $definitions = []; |
||
33 | |||
34 | /** |
||
35 | * Array of parameters |
||
36 | * @var ParameterBag |
||
37 | */ |
||
38 | protected $parameters; |
||
39 | |||
40 | /** |
||
41 | * @var DefinitionResolver |
||
42 | */ |
||
43 | protected $definitionResolver; |
||
44 | |||
45 | /** |
||
46 | * Defaults for the container. |
||
47 | * |
||
48 | * [ |
||
49 | * 'share' => true, |
||
50 | * 'autowire' => true |
||
51 | * ] |
||
52 | * @var array |
||
53 | */ |
||
54 | protected $defaults = [ |
||
55 | 'share' => true, |
||
56 | 'autowire' => true |
||
57 | ]; |
||
58 | |||
59 | public function __construct() |
||
65 | |||
66 | /** |
||
67 | * Register a definition. |
||
68 | * |
||
69 | * @param string $id |
||
70 | * @param mixed $concrete |
||
71 | * @return Definition |
||
72 | */ |
||
73 | public function register($id, $concrete = null) |
||
104 | |||
105 | /** |
||
106 | * Set a definition. |
||
107 | * |
||
108 | * @param string $id |
||
109 | * @param Definition $definition |
||
110 | * |
||
111 | * @return Definition |
||
112 | */ |
||
113 | public function setDefinition($id, Definition $definition) |
||
118 | |||
119 | /** |
||
120 | * Get a service instance by specified ID |
||
121 | * |
||
122 | * @param string $id |
||
123 | * @return object |
||
124 | */ |
||
125 | public function get($id) |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | public function has($id) |
||
164 | |||
165 | /** |
||
166 | * Gets all global parameters |
||
167 | * @return array |
||
168 | */ |
||
169 | public function getParameters() |
||
173 | |||
174 | /** |
||
175 | * Sets array of parameters |
||
176 | * @param array $parameterStore |
||
177 | */ |
||
178 | public function setParameters(array $parameterStore) |
||
182 | |||
183 | /** |
||
184 | * Add some parameters |
||
185 | * @param array $parameters |
||
186 | */ |
||
187 | public function addParameters(array $parameters) |
||
191 | |||
192 | /** |
||
193 | * Sets a parameter with its name and value |
||
194 | * |
||
195 | * @param $name |
||
196 | * @param mixed $value |
||
197 | */ |
||
198 | public function setParameter($name, $value) |
||
202 | |||
203 | /** |
||
204 | * Gets a parameter by given name |
||
205 | * @param $name |
||
206 | * @param mixed $default |
||
207 | * @return mixed |
||
208 | */ |
||
209 | public function getParameter($name, $default = null) |
||
213 | |||
214 | /** |
||
215 | * Gets a default option of the container. |
||
216 | * |
||
217 | * @param string $option |
||
218 | * @return mixed|null|boolean |
||
219 | */ |
||
220 | public function getDefault($option) |
||
224 | |||
225 | /** |
||
226 | * Configure defaults. |
||
227 | * |
||
228 | * @param array $defaults |
||
229 | * @return array |
||
230 | */ |
||
231 | public function setDefaults(array $defaults) |
||
235 | } |
||
236 |
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: