1 | <?php |
||
19 | class Container implements ContainerInterface |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $aliases = []; |
||
26 | |||
27 | /** |
||
28 | * Array of singletons |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $services = []; |
||
32 | |||
33 | /** |
||
34 | * Array of Definitions |
||
35 | * |
||
36 | * @var Definition[] |
||
37 | */ |
||
38 | protected $definitions = []; |
||
39 | |||
40 | /** |
||
41 | * Array of parameters |
||
42 | * @var ParameterBag |
||
43 | */ |
||
44 | protected $parameters; |
||
45 | |||
46 | /** |
||
47 | * @var DefinitionResolver |
||
48 | */ |
||
49 | protected $definitionResolver; |
||
50 | |||
51 | /** |
||
52 | * Defaults for the container. |
||
53 | * |
||
54 | * [ |
||
55 | * 'share' => true, |
||
56 | * 'autowire' => true |
||
57 | * ] |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $defaults = [ |
||
61 | 'share' => true, |
||
62 | 'autowire' => true |
||
63 | ]; |
||
64 | |||
65 | public function __construct() |
||
71 | |||
72 | /** |
||
73 | * Register a definition. |
||
74 | * |
||
75 | * @param string $id |
||
76 | * @param mixed $concrete |
||
77 | * @return Definition |
||
78 | */ |
||
79 | public function register($id, $concrete = null) |
||
110 | |||
111 | /** |
||
112 | * Set a definition. |
||
113 | * |
||
114 | * @param string $id |
||
115 | * @param Definition $definition |
||
116 | * |
||
117 | * @return Definition |
||
118 | */ |
||
119 | public function setDefinition($id, Definition $definition) |
||
124 | |||
125 | /** |
||
126 | * Sets an alias for an existing service. |
||
127 | * |
||
128 | * @param string $alias |
||
129 | * @param string $id |
||
130 | */ |
||
131 | public function setAlias($alias, $id) |
||
135 | |||
136 | /** |
||
137 | * Get id of the alias. |
||
138 | * |
||
139 | * @param string $alias |
||
140 | * @return string|null |
||
141 | */ |
||
142 | public function getAlias($alias) |
||
146 | |||
147 | /** |
||
148 | * Get a service instance by specified ID |
||
149 | * |
||
150 | * @param string $id |
||
151 | * @return object |
||
152 | */ |
||
153 | public function get($id) |
||
182 | |||
183 | /** |
||
184 | * {@inheritdoc} |
||
185 | */ |
||
186 | public function has($id) |
||
196 | |||
197 | /** |
||
198 | * Gets all global parameters |
||
199 | * @return array |
||
200 | */ |
||
201 | public function getParameters() |
||
205 | |||
206 | /** |
||
207 | * Sets array of parameters |
||
208 | * @param array $parameterStore |
||
209 | */ |
||
210 | public function setParameters(array $parameterStore) |
||
214 | |||
215 | /** |
||
216 | * Add some parameters |
||
217 | * @param array $parameters |
||
218 | */ |
||
219 | public function addParameters(array $parameters) |
||
223 | |||
224 | /** |
||
225 | * Sets a parameter with its name and value |
||
226 | * |
||
227 | * @param $name |
||
228 | * @param mixed $value |
||
229 | */ |
||
230 | public function setParameter($name, $value) |
||
234 | |||
235 | /** |
||
236 | * Gets a parameter by given name |
||
237 | * @param $name |
||
238 | * @param mixed $default |
||
239 | * @return mixed |
||
240 | */ |
||
241 | public function getParameter($name, $default = null) |
||
245 | |||
246 | /** |
||
247 | * Gets a default option of the container. |
||
248 | * |
||
249 | * @param string $option |
||
250 | * @return mixed|null|boolean |
||
251 | */ |
||
252 | public function getDefault($option) |
||
256 | |||
257 | /** |
||
258 | * Configure defaults. |
||
259 | * |
||
260 | * @param array $defaults |
||
261 | * @return array |
||
262 | */ |
||
263 | public function setDefaults(array $defaults) |
||
267 | } |
||
268 |
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: