Skip to content

Commit 8d07449

Browse files
committed
bug #13405 [TwigBridge] exit when Twig environment is not set in the LintCommand (xabbuh)
This PR was merged into the 2.5 branch. Discussion ---------- [TwigBridge] exit when Twig environment is not set in the LintCommand | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | 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. Commits ------- 05a4602 exit when Twig environment is not set
2 parents 1d8fc92 + 05a4602 commit 8d07449

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ protected function configure()
8787
protected function execute(InputInterface $input, OutputInterface $output)
8888
{
8989
$twig = $this->getTwigEnvironment();
90+
91+
if (null === $twig) {
92+
$output->writeln('<error>The Twig environment needs to be set.</error>');
93+
94+
return 1;
95+
}
96+
9097
$filename = $input->getArgument('filename');
9198

9299
if (!$filename) {

0 commit comments

Comments
 (0)