1 | <?php |
||
18 | class CallbackContainerBuilder implements ContainerBuilder { |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $registry = array(); |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $singletons = array(); |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $expectedReturnTypeByHandler = array(); |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $recursiveMarker = array(); |
||
39 | |||
40 | /** |
||
41 | * @since 2.0 |
||
42 | * |
||
43 | * @param CallbackContainer|null $callbackContainer |
||
44 | */ |
||
45 | public function __construct( CallbackContainer $callbackContainer = null ) { |
||
50 | |||
51 | /** |
||
52 | * @since 2.0 |
||
53 | * |
||
54 | * @param CallbackContainer $callbackContainer |
||
55 | */ |
||
56 | public function registerCallbackContainer( CallbackContainer $callbackContainer ) { |
||
59 | |||
60 | /** |
||
61 | * @since 2.0 |
||
62 | * |
||
63 | * @param string $file |
||
64 | * @throws FileNotFoundException |
||
65 | */ |
||
66 | public function registerFromFile( $file ) { |
||
83 | |||
84 | /** |
||
85 | * @since 2.0 |
||
86 | * |
||
87 | * {@inheritDoc} |
||
88 | */ |
||
89 | public function registerCallback( $serviceName, Closure $callback ) { |
||
97 | |||
98 | /** |
||
99 | * If you are not running PHPUnit or for that matter any other testing |
||
100 | * environment then you are not suppose to use this function. |
||
101 | * |
||
102 | * @since 2.0 |
||
103 | * |
||
104 | * @param string $serviceName |
||
105 | * @param mixed $instance |
||
106 | */ |
||
107 | public function registerObject( $serviceName, $instance ) { |
||
118 | |||
119 | /** |
||
120 | * @since 2.0 |
||
121 | * |
||
122 | * {@inheritDoc} |
||
123 | */ |
||
124 | public function registerExpectedReturnType( $serviceName, $type ) { |
||
132 | |||
133 | /** |
||
134 | * @since 2.0 |
||
135 | * |
||
136 | * {@inheritDoc} |
||
137 | */ |
||
138 | public function isRegistered( $serviceName ) { |
||
141 | |||
142 | /** |
||
143 | * @since 2.0 |
||
144 | * |
||
145 | * {@inheritDoc} |
||
146 | */ |
||
147 | public function create( $serviceName ) { |
||
150 | |||
151 | /** |
||
152 | * @since 2.0 |
||
153 | * |
||
154 | * {@inheritDoc} |
||
155 | */ |
||
156 | public function singleton( $serviceName ) { |
||
159 | |||
160 | /** |
||
161 | * @since 2.0 |
||
162 | * |
||
163 | * @param string $serviceName |
||
164 | */ |
||
165 | public function deregister( $serviceName ) { |
||
170 | |||
171 | private function addRecursiveMarkerFor( $serviceName ) { |
||
187 | |||
188 | private function getReturnValueFromCallbackHandlerFor( $serviceName, $parameters ) { |
||
213 | |||
214 | private function getReturnValueFromSingletonFor( $serviceName, $parameters ) { |
||
241 | |||
242 | } |
||
243 |
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: