Skip to content

Commit ffa5790

Browse files
committed
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
2 parents 0a44afa + 3c6043e commit ffa5790

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ private function findProperServiceName(InputInterface $input, SymfonyStyle $io,
192192
throw new \InvalidArgumentException(sprintf('No services found that match "%s".', $name));
193193
}
194194

195-
return $io->choice('Select one of the following services to display its information', $matchingServices);
195+
$default = 1 === count($matchingServices) ? $matchingServices[0] : null;
196+
197+
return $io->choice('Select one of the following services to display its information', $matchingServices, $default);
196198
}
197199

198200
private function findServiceIdsContaining(ContainerBuilder $builder, $name)

0 commit comments

Comments
 (0)