As soon as I add a custom function to my Volt compiler in services.php, for some reason my PHP files stop compiling to my /cache/ directory, and instead compile to the same directory as the volt files. What is the reason for this?
This is the relevant code in my services.php:
$view->registerEngines([
'.volt' => function ($view) {
$config = $this->getConfig();
$volt = new VoltEngine($view, $this);
// Adding these two lines breaks where my code compiles
$compiler = $volt->getCompiler();
$compiler->addFunction('get_object_vars', 'get_object_vars');
$volt->setOptions([
'compiledPath' => $config->application->cacheDir,
'compiledSeparator' => '_'
]);
return $volt;
}
]);