bug #24851 [TwigBridge] Fix BC break due required twig environment (ro0NL)
This PR was squashed before being merged into the 3.4 branch (closes #24851).
Discussion
----------
[TwigBridge] Fix BC break due required twig environment
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes/no
| Fixed tickets | https://github.com/symfony/symfony/pull/24236#discussion_r149241720
| License | MIT
| Doc PR | symfony/symfony-docs#... <!--highly recommended for new features-->
See https://github.com/ezsystems/ezplatform-design-engine/pull/12 + https://github.com/silexphp/Silex-WebProfiler/pull/126 + https://github.com/bolt/bolt/pull/7154
Sorry for that :)
cc @fabpot
Commits
-------
243e4b2
[TwigBridge] Fix BC break due required twig environment
This commit is contained in:
commit
69b48d0122
@ -31,7 +31,7 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
private $twig;
|
||||
private $computed;
|
||||
|
||||
public function __construct(Profile $profile, Environment $twig)
|
||||
public function __construct(Profile $profile, Environment $twig = null)
|
||||
{
|
||||
$this->profile = $profile;
|
||||
$this->twig = $twig;
|
||||
@ -62,6 +62,10 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
|
||||
$this->data['profile'] = serialize($this->profile);
|
||||
$this->data['template_paths'] = array();
|
||||
|
||||
if (null === $this->twig) {
|
||||
return;
|
||||
}
|
||||
|
||||
$templateFinder = function (Profile $profile) use (&$templateFinder) {
|
||||
if ($profile->isTemplate()) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user