From 1cfc1b7fe71732e81923ab93f32ca7f82831cbed Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 13 Jan 2015 20:43:24 +0100 Subject: [PATCH] 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. --- src/Symfony/Bridge/Twig/Command/DebugCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index bb81615a6c..27482e732c 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -83,6 +83,13 @@ EOF protected function execute(InputInterface $input, OutputInterface $output) { $twig = $this->getTwigEnvironment(); + + if (null === $twig) { + $output->writeln('The Twig environment needs to be set.'); + + return 1; + } + $types = array('functions', 'filters', 'tests', 'globals'); if ($input->getOption('format') === 'json') {