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();
foreach ($this->services as $key => $associatedService) {
$lev = levenshtein($id, $key);
if ($lev <= strlen($id) / 3 || false !== strpos($key, $id)) {
$alternatives[] = $key;
foreach ($this->getServiceIds() as $knownId) {
$lev = levenshtein($id, $knownId);
if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) {
$alternatives[] = $knownId;
}
}

View File

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