@@ -217,26 +217,24 @@ private function set($type, $id)
217
217
218
218
// is this already a type/class that is known to match multiple services?
219
219
if (isset ($ this ->ambiguousServiceTypes [$ type ])) {
220
- $ this ->addServiceToAmbiguousType ( $ id , $ type ) ;
220
+ $ this ->ambiguousServiceTypes [ $ type ][] = $ id ;
221
221
222
222
return ;
223
223
}
224
224
225
225
// check to make sure the type doesn't match multiple services
226
- if (isset ($ this ->types [$ type ])) {
227
- if ($ this ->types [$ type ] === $ id ) {
228
- return ;
229
- }
230
-
231
- // keep an array of all services matching this type
232
- $ this ->addServiceToAmbiguousType ($ id , $ type );
233
-
234
- unset($ this ->types [$ type ]);
226
+ if (!isset ($ this ->types [$ type ]) || $ this ->types [$ type ] === $ id ) {
227
+ $ this ->types [$ type ] = $ id ;
235
228
236
229
return ;
237
230
}
238
231
239
- $ this ->types [$ type ] = $ id ;
232
+ // keep an array of all services matching this type
233
+ if (!isset ($ this ->ambiguousServiceTypes [$ type ])) {
234
+ $ this ->ambiguousServiceTypes [$ type ] = array ($ this ->types [$ type ]);
235
+ unset($ this ->types [$ type ]);
236
+ }
237
+ $ this ->ambiguousServiceTypes [$ type ][] = $ id ;
240
238
}
241
239
242
240
/**
@@ -311,17 +309,6 @@ private function getReflectionClass($id, Definition $definition)
311
309
return $ this ->reflectionClasses [$ id ] = $ reflector ;
312
310
}
313
311
314
- private function addServiceToAmbiguousType ($ id , $ type )
315
- {
316
- // keep an array of all services matching this type
317
- if (!isset ($ this ->ambiguousServiceTypes [$ type ])) {
318
- $ this ->ambiguousServiceTypes [$ type ] = array (
319
- $ this ->types [$ type ],
320
- );
321
- }
322
- $ this ->ambiguousServiceTypes [$ type ][] = $ id ;
323
- }
324
-
325
312
/**
326
313
* @param \ReflectionClass $reflectionClass
327
314
*
0 commit comments