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 | * Returns service ids for a given tag. |
||
199 | * |
||
200 | * Example: |
||
201 | * |
||
202 | * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); |
||
203 | * |
||
204 | * $serviceIds = $container->findTaggedServiceIds('my.tag'); |
||
205 | * foreach ($serviceIds as $serviceId => $tags) { |
||
206 | * foreach ($tags as $tag) { |
||
207 | * echo $tag['hello']; |
||
208 | * } |
||
209 | * } |
||
210 | * @param string $name |
||
211 | * @return array |
||
212 | */ |
||
213 | public function findTaggedServiceIds($name) |
||
223 | |||
224 | /** |
||
225 | * Gets all global parameters |
||
226 | * @return array |
||
227 | */ |
||
228 | public function getParameters() |
||
232 | |||
233 | /** |
||
234 | * Sets array of parameters |
||
235 | * @param array $parameterStore |
||
236 | */ |
||
237 | public function setParameters(array $parameterStore) |
||
241 | |||
242 | /** |
||
243 | * Add some parameters |
||
244 | * @param array $parameters |
||
245 | */ |
||
246 | public function addParameters(array $parameters) |
||
250 | |||
251 | /** |
||
252 | * Sets a parameter with its name and value |
||
253 | * |
||
254 | * @param $name |
||
255 | * @param mixed $value |
||
256 | */ |
||
257 | public function setParameter($name, $value) |
||
261 | |||
262 | /** |
||
263 | * Gets a parameter by given name |
||
264 | * @param $name |
||
265 | * @param mixed $default |
||
266 | * @return mixed |
||
267 | */ |
||
268 | public function getParameter($name, $default = null) |
||
272 | |||
273 | /** |
||
274 | * Gets a default option of the container. |
||
275 | * |
||
276 | * @param string $option |
||
277 | * @return mixed|null|boolean |
||
278 | */ |
||
279 | public function getDefault($option) |
||
283 | |||
284 | /** |
||
285 | * Configure defaults. |
||
286 | * |
||
287 | * @param array $defaults |
||
288 | * @return array |
||
289 | */ |
||
290 | public function setDefaults(array $defaults) |
||
294 | } |
||
295 |
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: