bug #13403 [TwigBridge] exit when Twig environment is not set in the DebugCommand (xabbuh)
This PR was merged into the 2.7 branch.
Discussion
----------
[TwigBridge] exit when Twig environment is not set in the DebugCommand
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
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.
Commits
-------
1cfc1b7
exit when Twig environment is not set
This commit is contained in:
commit
52e18c51ed
@ -83,6 +83,13 @@ EOF
|
|||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$twig = $this->getTwigEnvironment();
|
$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');
|
$types = array('functions', 'filters', 'tests', 'globals');
|
||||||
|
|
||||||
if ($input->getOption('format') === 'json') {
|
if ($input->getOption('format') === 'json') {
|
||||||
|
Reference in New Issue
Block a user