Skip to content

Commit fa341fd

Browse files
committed
LatteExtension: added option 'strictTypes'
1 parent 804688d commit fa341fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Bridges/ApplicationDI/LatteExtension.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class LatteExtension extends Nette\DI\CompilerExtension
2222
'xhtml' => FALSE,
2323
'macros' => [],
2424
'templateClass' => NULL,
25+
'strictTypes' => FALSE,
2526
];
2627

2728
/** @var bool */
@@ -47,14 +48,18 @@ public function loadConfiguration()
4748
$config = $this->validateConfig($this->defaults);
4849
$builder = $this->getContainerBuilder();
4950

50-
$builder->addDefinition($this->prefix('latteFactory'))
51+
$latteFactory = $builder->addDefinition($this->prefix('latteFactory'))
5152
->setClass(Latte\Engine::class)
5253
->addSetup('setTempDirectory', [$this->tempDir])
5354
->addSetup('setAutoRefresh', [$this->debugMode])
5455
->addSetup('setContentType', [$config['xhtml'] ? Latte\Compiler::CONTENT_XHTML : Latte\Compiler::CONTENT_HTML])
5556
->addSetup('Nette\Utils\Html::$xhtml = ?', [(bool) $config['xhtml']])
5657
->setImplement(Nette\Bridges\ApplicationLatte\ILatteFactory::class);
5758

59+
if ($config['strictTypes']) {
60+
$latteFactory->addSetup('setStrictTypes', [TRUE]);
61+
}
62+
5863
$builder->addDefinition($this->prefix('templateFactory'))
5964
->setClass(Nette\Application\UI\ITemplateFactory::class)
6065
->setFactory(Nette\Bridges\ApplicationLatte\TemplateFactory::class)

0 commit comments

Comments
 (0)