This repository was archived by the owner on Feb 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -248,27 +248,20 @@ public function build($name, array $options = null)
248
248
*/
249
249
public function has ($ name )
250
250
{
251
- // Check services and factories first to speedup the most common requests
252
- if (isset ($ this ->services [$ name ]) || isset ($ this ->factories [$ name ])) {
253
- return true ;
251
+ $ name = $ this ->resolvedAliases [$ name ] ?? $ name ;
252
+ $ found = isset ($ this ->services [$ name ]) || isset ($ this ->factories [$ name ]);
253
+
254
+ if ($ found ) {
255
+ return $ found ;
254
256
}
255
257
256
- // Check abstract factories next
258
+ // Check abstract factories
257
259
foreach ($ this ->abstractFactories as $ abstractFactory ) {
258
260
if ($ abstractFactory ->canCreate ($ this ->creationContext , $ name )) {
259
261
return true ;
260
262
}
261
263
}
262
264
263
- // If $name is no alias, we are done
264
- if (! isset ($ this ->resolvedAliases [$ name ])) {
265
- return false ;
266
- }
267
-
268
- // Finally check aliases
269
- $ name = $ this ->resolvedAliases [$ name ];
270
- return isset ($ this ->services [$ name ]) || isset ($ this ->factories [$ name ]);
271
-
272
265
return false ;
273
266
}
274
267
You can’t perform that action at this time.
0 commit comments