diff --git a/src/Bridges/ApplicationDI/LatteExtension.php b/src/Bridges/ApplicationDI/LatteExtension.php index 7562087f3..b3e2bb703 100644 --- a/src/Bridges/ApplicationDI/LatteExtension.php +++ b/src/Bridges/ApplicationDI/LatteExtension.php @@ -22,6 +22,7 @@ class LatteExtension extends Nette\DI\CompilerExtension 'xhtml' => FALSE, 'macros' => [], 'templateClass' => NULL, + 'strictTypes' => FALSE, ]; /** @var bool */ @@ -47,7 +48,7 @@ public function loadConfiguration() $config = $this->validateConfig($this->defaults); $builder = $this->getContainerBuilder(); - $builder->addDefinition($this->prefix('latteFactory')) + $latteFactory = $builder->addDefinition($this->prefix('latteFactory')) ->setClass(Latte\Engine::class) ->addSetup('setTempDirectory', [$this->tempDir]) ->addSetup('setAutoRefresh', [$this->debugMode]) @@ -55,6 +56,10 @@ public function loadConfiguration() ->addSetup('Nette\Utils\Html::$xhtml = ?', [(bool) $config['xhtml']]) ->setImplement(Nette\Bridges\ApplicationLatte\ILatteFactory::class); + if ($config['strictTypes']) { + $latteFactory->addSetup('setStrictTypes', [TRUE]); + } + $builder->addDefinition($this->prefix('templateFactory')) ->setClass(Nette\Application\UI\ITemplateFactory::class) ->setFactory(Nette\Bridges\ApplicationLatte\TemplateFactory::class)