@@ -180,6 +180,7 @@ public function testWildcards()
180180 'Namespaced\*Interface '  => \DI \create ('Namespaced\* ' ),
181181 'Namespaced2\*Interface '  => \DI \create ('Namespaced2\Foo ' ),
182182 'Multiple\*\*\Matches '  => \DI \create ('Multiple\*\*\Implementation ' ),
183+  '*Interface '  => \DI \create ('GlobalImplementation ' ),
183184 ]);
184185
185186 $ definition$ sourcegetDefinition ('foo1 ' );
@@ -201,6 +202,11 @@ public function testWildcards()
201202 $ this assertInstanceOf (ObjectDefinition::class, $ definition
202203 $ this assertEquals ('Multiple\Foo\Bar\Matches ' , $ definitiongetName ());
203204 $ this assertEquals ('Multiple\Foo\Bar\Implementation ' , $ definitiongetClassName ());
205+ 
206+  $ definition$ sourcegetDefinition ('GlobalInterface ' );
207+  $ this assertInstanceOf (ObjectDefinition::class, $ definition
208+  $ this assertEquals ('GlobalInterface ' , $ definitiongetName ());
209+  $ this assertEquals ('GlobalImplementation ' , $ definitiongetClassName ());
204210 }
205211
206212 /** 
@@ -240,6 +246,17 @@ public function testWildcardShouldNotMatchAcrossNamespaces()
240246 $ this assertNull ($ sourcegetDefinition ('My\Foo\BarInterface ' ));
241247 }
242248
249+  /** 
250+  * The wildcard for global namespace should not match across namespaces. 
251+  */ 
252+  public  function  testGlobalNamespaceWildcardShouldNotMatchAcrossNamespace ()
253+  {
254+  $ sourcenew  DefinitionArray ([
255+  '*Interface '  => \DI \create (),
256+  ]);
257+  $ this assertNull ($ sourcegetDefinition ('My\FooInterface ' ));
258+  }
259+ 
243260 /** 
244261 * @see https://github.com/PHP-DI/PHP-DI/issues/379 
245262 */ 
0 commit comments