@@ -19,12 +19,12 @@ class HelperOptions
1919 * @param array<mixed> $outerBlockParams outer block param stack, passed as trailing elements of the stack
2020 */
2121 public function __construct (
22- public mixed & $ scope ,
22+ public mixed $ scope ,
2323 public array &$ data ,
24+ private readonly RuntimeContext $ cx ,
2425 public readonly string $ name = '' ,
2526 public readonly array $ hash = [],
2627 public readonly int $ blockParams = 0 ,
27- private readonly ?RuntimeContext $ cx = null ,
2828 private readonly ?Closure $ cb = null ,
2929 private readonly ?Closure $ inv = null ,
3030 private readonly array $ outerBlockParams = [],
@@ -45,9 +45,7 @@ public function __isset(string $name): bool
4545
4646 public function fn (mixed $ context = Scope::Use, mixed $ data = null ): string
4747 {
48- if ($ this ->cx === null ) {
49- throw new \Exception ('fn() is not supported for inline helpers ' );
50- } elseif ($ this ->cb === null ) {
48+ if ($ this ->cb === null ) {
5149 return '' ;
5250 }
5351 $ cx = $ this ->cx ;
@@ -87,9 +85,7 @@ public function fn(mixed $context = Scope::Use, mixed $data = null): string
8785
8886 public function inverse (mixed $ context = null , mixed $ data = null ): string
8987 {
90- if ($ this ->cx === null ) {
91- throw new \Exception ('inverse() is not supported for inline helpers ' );
92- } elseif ($ this ->inv === null ) {
88+ if ($ this ->inv === null ) {
9389 return '' ;
9490 }
9591 $ cx = $ this ->cx ;
@@ -134,7 +130,6 @@ public function iterate(array $items): string
134130 return '' ;
135131 }
136132 $ cx = $ this ->cx ;
137- assert ($ cx !== null );
138133 $ cb = $ this ->cb ;
139134
140135 // Push depths and save partials once for the entire loop.
@@ -181,7 +176,6 @@ public function iterate(array $items): string
181176 private function applyData (array $ data ): array
182177 {
183178 $ cx = $ this ->cx ;
184- assert ($ cx !== null );
185179 $ savedFrame = null ;
186180 $ bpStack = null ;
187181
0 commit comments