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.
This commit is contained in:
Christian Flothmann 2015-01-13 20:56:15 +01:00
parent 1d8fc92dbe
commit 05a4602450
1 changed files with 7 additions and 0 deletions

View File

@ -87,6 +87,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;
}
$filename = $input->getArgument('filename');
if (!$filename) {