Skip to content

Commit 43b4db7

Browse files
authored
chore: local defined variables cleanup (#580)
1 parent 7d56eb2 commit 43b4db7

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/Tempest/View/src/Renderers/TempestViewRenderer.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function render(string|View $view): string
4040

4141
$path = $this->viewCache->getCachedViewPath(
4242
path: $view->getPath(),
43-
compiledView: fn () => $this->cleanupCompiled($this->compiler->compile($view->getPath()))
43+
compiledView: fn () => $this->cleanupCompiled($this->compiler->compile($view->getPath())),
4444
);
4545

4646
return $this->renderCompiled($view, $path);
@@ -91,13 +91,6 @@ private function renderCompiled(View $_view, string $_path): string
9191
throw new ViewCompilationError(content: file_get_contents($_path), previous: $throwable);
9292
}
9393

94-
// If the view defines local variables, we add them here to the view object as well
95-
foreach (get_defined_vars() as $key => $value) {
96-
if (! $_view->has($key)) {
97-
$_view->data(...[$key => $value]);
98-
}
99-
}
100-
10194
$this->currentView = null;
10295

10396
return trim(ob_get_clean());

0 commit comments

Comments
 (0)