From 05a4602450ad9b5bc7327f71620cba37e8ffc2f2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 13 Jan 2015 20:56:15 +0100 Subject: [PATCH] exit when Twig environment is not set The `LintCommand` 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/LintCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php index 276b6b9672..243804ccb5 100644 --- a/src/Symfony/Bridge/Twig/Command/LintCommand.php +++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php @@ -87,6 +87,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; + } + $filename = $input->getArgument('filename'); if (!$filename) {