From c975de0557ad7b32311977dd647fa95f675852d4 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Tue, 11 Nov 2025 18:23:45 +0000 Subject: [PATCH] - variable of block can't be overwritten --- src/ControlStructure/BlockToken.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ControlStructure/BlockToken.php b/src/ControlStructure/BlockToken.php index cfa04e6..cd718c1 100644 --- a/src/ControlStructure/BlockToken.php +++ b/src/ControlStructure/BlockToken.php @@ -229,10 +229,9 @@ class BlockToken implements ControlStructure { $this->rendering = true; if ($this->using['this'] ?? false) { - $thisProxy = $this->using['this']; - unset($this->using['this']); + throw new \InvalidArgumentException("Block '{$this->viewPath}' cannot overwrite 'this' variable."); } - + return $classTemplate->picea->inlineBlock($thisProxy ?? $this, $this->viewPath, ...$this->arguments); }