diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php index dff1c3d28f..f5cbd96d9e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/EventDispatcherDebugCommand.php @@ -58,14 +58,28 @@ EOF */ protected function execute(InputInterface $input, OutputInterface $output) { + $dispatcher = $this->getEventDispatcher(); + if ($event = $input->getArgument('event')) { + if (!$dispatcher->hasListeners($event)) { + $formatter = $this->getHelperSet()->get('formatter'); + + $formattedBlock = $formatter->formatBlock( + sprintf('[NOTE] The event "%s" does not have any registered listeners.', $event), + 'fg=yellow', + true + ); + + $output->writeln($formattedBlock); + + return; + } + $options = array('event' => $event); } else { $options = array(); } - $dispatcher = $this->getEventDispatcher(); - $helper = new DescriptorHelper(); $options['format'] = $input->getOption('format'); $options['raw_text'] = $input->getOption('raw');