exit when Twig environment is not set

The `DebugCommand` from the TwigBridge requires the `Twig_Environment`
to be set. Thus, if the `setTwigEnvironment()` were not called, the
command execution would have been aborted with a PHP error.
This commit is contained in:
Christian Flothmann 2015-01-13 20:43:24 +01:00
parent 40854edb1f
commit 1cfc1b7fe7
1 changed files with 7 additions and 0 deletions

View File

@ -83,6 +83,13 @@ EOF
protected function execute(InputInterface $input, OutputInterface $output)
{
$twig = $this->getTwigEnvironment();
if (null === $twig) {
$output->writeln('<error>The Twig environment needs to be set.</error>');
return 1;
}
$types = array('functions', 'filters', 'tests', 'globals');
if ($input->getOption('format') === 'json') {