[TwigBridge] Fix BC break due required twig environment

This commit is contained in:
Roland Franssen 2017-11-07 09:08:12 +01:00 committed by Nicolas Grekas
parent 0aedd686dd
commit 243e4b2e2f

View File

@ -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 {