1 | <?php |
||
14 | class Definition |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $class; |
||
20 | |||
21 | /** |
||
22 | * Array of arguments |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $arguments = []; |
||
26 | |||
27 | /** |
||
28 | * Array of setters |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $calls = []; |
||
32 | |||
33 | /** |
||
34 | * Array of properties |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $properties = []; |
||
38 | |||
39 | /** |
||
40 | * ['@Foo\Bar', 'createBaz'] |
||
41 | * or |
||
42 | * ['Foo\Bar', 'createBaz'] |
||
43 | * @var \callable |
||
44 | */ |
||
45 | protected $factory; |
||
46 | |||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $tags; |
||
51 | |||
52 | /** |
||
53 | * @var boolean |
||
54 | */ |
||
55 | protected $autowired; |
||
56 | |||
57 | /** |
||
58 | * @var boolean |
||
59 | */ |
||
60 | protected $shared; |
||
61 | |||
62 | /** |
||
63 | * @var boolean |
||
64 | */ |
||
65 | protected $public; |
||
66 | |||
67 | public function __construct( |
||
74 | |||
75 | /** |
||
76 | * Set class for the definition. |
||
77 | * |
||
78 | * @param string $class |
||
79 | */ |
||
80 | public function setClass($class) |
||
84 | |||
85 | /** |
||
86 | * Gets the class |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getClass() |
||
93 | |||
94 | /** |
||
95 | * @param callable $factory |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function setFactory($factory) |
||
103 | |||
104 | /** |
||
105 | * @return callable |
||
106 | */ |
||
107 | public function getFactory() |
||
111 | |||
112 | /** |
||
113 | * @param array $properties |
||
114 | */ |
||
115 | public function setProperties($properties) |
||
119 | |||
120 | /** |
||
121 | * Gets all properties |
||
122 | * @return array |
||
123 | */ |
||
124 | public function getProperties() |
||
128 | |||
129 | /** |
||
130 | * Adds a property |
||
131 | * @param int|string $name |
||
132 | * @param mixed $value |
||
133 | * @return $this |
||
134 | */ |
||
135 | public function setProperty($name, $value) |
||
141 | |||
142 | /** |
||
143 | * Gets the property by given name |
||
144 | * @param string $name |
||
145 | * @return mixed |
||
146 | */ |
||
147 | public function getProperty($name) |
||
151 | |||
152 | /** |
||
153 | * add an argument |
||
154 | * |
||
155 | * @param mixed $value |
||
156 | * |
||
157 | * @return $this |
||
158 | */ |
||
159 | public function addArgument($value) |
||
164 | |||
165 | /** |
||
166 | * Sets a specific argument. |
||
167 | * |
||
168 | * @param string $key |
||
169 | * @param mixed $value |
||
170 | * @return $this |
||
171 | */ |
||
172 | public function setArgument($key, $value) |
||
177 | |||
178 | /** |
||
179 | * Sets the arguments to pass to the service constructor/factory method. |
||
180 | * |
||
181 | * @param array $arguments |
||
182 | * @return $this |
||
183 | */ |
||
184 | public function setArguments(array $arguments) |
||
189 | |||
190 | /** |
||
191 | * Gets all arguments of constructor |
||
192 | * |
||
193 | * @return array |
||
194 | */ |
||
195 | public function getArguments() |
||
199 | |||
200 | /** |
||
201 | * Gets the argument at the specified position of constructor |
||
202 | * |
||
203 | * @param int|string $index |
||
204 | * @return mixed |
||
205 | */ |
||
206 | public function getArgument($index) |
||
210 | |||
211 | /** |
||
212 | * Adds a method |
||
213 | * |
||
214 | * @param string $method |
||
215 | * @param string|array $arguments |
||
216 | * @return $this |
||
217 | */ |
||
218 | public function addMethodCall($method, $arguments) |
||
226 | |||
227 | /** |
||
228 | * Sets the methods to call after service initialization. |
||
229 | * |
||
230 | * @param array methods |
||
231 | * @return $this |
||
232 | */ |
||
233 | public function setMethodCalls(array $methods) |
||
242 | |||
243 | /** |
||
244 | * Gets all methods |
||
245 | * |
||
246 | * @return array |
||
247 | */ |
||
248 | public function getMethodCalls() |
||
252 | |||
253 | /** |
||
254 | * Check if the current definition has a given method to call after service initialization. |
||
255 | * |
||
256 | * @param string $method The method name to search for |
||
257 | * |
||
258 | * @return bool |
||
259 | */ |
||
260 | public function hasMethodCall($method) |
||
270 | |||
271 | /** |
||
272 | * Sets tags for this definition. |
||
273 | * |
||
274 | * @param array $tags |
||
275 | * @return $this |
||
276 | */ |
||
277 | public function setTags(array $tags) |
||
283 | |||
284 | /** |
||
285 | * Returns all tags. |
||
286 | * |
||
287 | * @return array An array of tags |
||
288 | */ |
||
289 | public function getTags() |
||
293 | |||
294 | /** |
||
295 | * Gets a tag by name. |
||
296 | * |
||
297 | * @param string $name The tag name |
||
298 | * |
||
299 | * @return array An array of attributes |
||
300 | */ |
||
301 | public function getTag($name) |
||
305 | |||
306 | /** |
||
307 | * Adds a tag for this definition. |
||
308 | * |
||
309 | * @param string $name The tag name |
||
310 | * @param array $attributes An array of attributes |
||
311 | * |
||
312 | * @return $this |
||
313 | */ |
||
314 | public function addTag($name, array $attributes = array()) |
||
320 | |||
321 | /** |
||
322 | * Whether this definition has a tag with the given name. |
||
323 | * |
||
324 | * @param string $name |
||
325 | * |
||
326 | * @return bool |
||
327 | */ |
||
328 | public function hasTag($name) |
||
332 | |||
333 | /** |
||
334 | * Clears all tags for a given name. |
||
335 | * |
||
336 | * @param string $name The tag name |
||
337 | * |
||
338 | * @return $this |
||
339 | */ |
||
340 | public function clearTag($name) |
||
346 | |||
347 | /** |
||
348 | * Clears the tags for this definition. |
||
349 | * |
||
350 | * @return $this |
||
351 | */ |
||
352 | public function clearTags() |
||
358 | |||
359 | /** |
||
360 | * Is the definition autowired? |
||
361 | * |
||
362 | * @return bool |
||
363 | */ |
||
364 | public function isAutowired() |
||
368 | |||
369 | /** |
||
370 | * Enables/disables autowiring. |
||
371 | * |
||
372 | * @param bool $autowired |
||
373 | * |
||
374 | * @return $this |
||
375 | */ |
||
376 | public function setAutowired($autowired) |
||
382 | |||
383 | /** |
||
384 | * Sets if the service must be shared or not. |
||
385 | * |
||
386 | * @param bool $shared Whether the service must be shared or not |
||
387 | * |
||
388 | * @return $this |
||
389 | */ |
||
390 | public function setShared($shared) |
||
398 | |||
399 | /** |
||
400 | * Whether this service is shared. |
||
401 | * |
||
402 | * @return bool |
||
403 | */ |
||
404 | public function isShared() |
||
408 | |||
409 | /** |
||
410 | * Sets the visibility of this service. |
||
411 | * |
||
412 | * @param bool $boolean |
||
413 | * |
||
414 | * @return $this |
||
415 | */ |
||
416 | public function setPublic($boolean) |
||
422 | |||
423 | /** |
||
424 | * Whether this service is public facing. |
||
425 | * |
||
426 | * @return bool |
||
427 | */ |
||
428 | public function isPublic() |
||
432 | } |
||
433 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..