This repository was archived by the owner on Feb 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,16 @@ public function has($name)
267
267
268
268
// Finally check aliases
269
269
$ resolvedName = $ this ->aliases [$ name ];
270
- return isset ($ this ->services [$ resolvedName ]) || isset ($ this ->factories [$ resolvedName ]);
270
+ if (isset ($ this ->services [$ resolvedName ]) || isset ($ this ->factories [$ resolvedName ])) {
271
+ return true ;
272
+ }
273
+
274
+ // Check abstract factories on $resolvedName also
275
+ foreach ($ this ->abstractFactories as $ abstractFactory ) {
276
+ if ($ abstractFactory ->canCreate ($ this ->creationContext , $ resolvedName )) {
277
+ return true ;
278
+ }
279
+ }
271
280
}
272
281
273
282
/**
Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ public function testSetAliasShouldWorkWithRecursiveAlias()
272
272
self ::assertSame ($ service , $ headAlias );
273
273
}
274
274
275
- public function testAbstractFactoryShouldBeCheckedForResolvedAliasesInsteadOfAliasNameName ()
275
+ public function testAbstractFactoryShouldBeCheckedForResolvedAliasesInsteadOfAliasName ()
276
276
{
277
277
$ abstractFactory = $ this ->createMock (AbstractFactoryInterface::class);
278
278
@@ -288,8 +288,8 @@ public function testAbstractFactoryShouldBeCheckedForResolvedAliasesInsteadOfAli
288
288
$ abstractFactory
289
289
->expects (self ::once ())
290
290
->method ('canCreate ' )
291
- ->with (self :: anything (), ' ServiceName ' )
292
- ->willReturn (true );
291
+ ->with ($ this -> anything ())
292
+ ->willReturn ($ this -> equalTo ( ' ServiceName ' ) );
293
293
294
294
$ this ->assertTrue ($ serviceManager ->has ('Alias ' ));
295
295
}
You can’t perform that action at this time.
0 commit comments