Skip to content

Commit ef23b63

Browse files
weaverryanfabpot
authored andcommitted
Prevent an empty choice list being passed in debug:container
1 parent 46d18f4 commit ef23b63

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ private function findProperServiceName(InputInterface $input, OutputInterface $o
184184
return $name;
185185
}
186186

187-
$question = new ChoiceQuestion('Choose a number for more information on the service', $this->findServiceIdsContaining($builder, $name));
187+
$matchingServices = $this->findServiceIdsContaining($builder, $name);
188+
if (empty($matchingServices)) {
189+
throw new \InvalidArgumentException(sprintf('No services found that match "%s".', $name));
190+
}
191+
192+
$question = new ChoiceQuestion('Choose a number for more information on the service', $matchingServices);
188193
$question->setErrorMessage('Service %s is invalid.');
189194

190195
return $this->getHelper('question')->ask($input, $output, $question);

0 commit comments

Comments
 (0)