include dynamic services in list of alternatives

This commit is contained in:
Roland Franssen 2016-08-20 08:07:04 +00:00
parent 7b383a9788
commit 428b5cc6a8
2 changed files with 4 additions and 5 deletions

View File

@ -288,10 +288,10 @@ class Container implements IntrospectableContainerInterface
} }
$alternatives = array(); $alternatives = array();
foreach ($this->services as $key => $associatedService) { foreach ($this->getServiceIds() as $knownId) {
$lev = levenshtein($id, $key); $lev = levenshtein($id, $knownId);
if ($lev <= strlen($id) / 3 || false !== strpos($key, $id)) { if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) {
$alternatives[] = $key; $alternatives[] = $knownId;
} }
} }

View File

@ -219,7 +219,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase
{ {
$sc = new ProjectServiceContainer(); $sc = new ProjectServiceContainer();
$sc->set('foo', $foo = new \stdClass()); $sc->set('foo', $foo = new \stdClass());
$sc->set('bar', $foo = new \stdClass());
$sc->set('baz', $foo = new \stdClass()); $sc->set('baz', $foo = new \stdClass());
try { try {