feature #17726 [FrameworkBundle] Improve debug:container command (voronkovich)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[FrameworkBundle] Improve debug:container command

| Q | A |
 ------------- | --- |
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
License | MIT |

When the only one service found we could set it as a default value, so user have to just press enter to see it's definition.

Commits
-------

3c6043e Improve debug:container command
This commit is contained in:
Fabien Potencier 2016-02-12 17:16:39 +01:00
commit ffa5790f6e

View File

@ -192,7 +192,9 @@ EOF
throw new \InvalidArgumentException(sprintf('No services found that match "%s".', $name));
}
return $io->choice('Select one of the following services to display its information', $matchingServices);
$default = 1 === count($matchingServices) ? $matchingServices[0] : null;
return $io->choice('Select one of the following services to display its information', $matchingServices, $default);
}
private function findServiceIdsContaining(ContainerBuilder $builder, $name)