@@ -230,12 +230,12 @@ public static function hv(RuntimeContext $cx, string $name, mixed &$_this): mixe
230230 {
231231 $ helper = $ cx ->helpers [$ name ] ?? null ;
232232 if ($ helper !== null ) {
233- return static ::hbch ($ cx , $ helper , $ name , [], [], $ _this );
233+ return static ::hbch ($ cx , $ helper , $ name , 0 , [], [], $ _this );
234234 }
235235 if (is_array ($ _this ) && array_key_exists ($ name , $ _this )) {
236236 return static ::dv ($ _this [$ name ]);
237237 }
238- return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , [], [], $ _this );
238+ return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , 0 , [], [], $ _this );
239239 }
240240
241241 /**
@@ -427,24 +427,24 @@ public static function in(RuntimeContext $cx, string $name, \Closure $partial):
427427 * @param array<mixed> $positional
428428 * @param array<string, mixed> $hash
429429 */
430- public static function dynhbch (RuntimeContext $ cx , string $ name , array $ positional , array $ hash , mixed &$ _this ): mixed
430+ public static function dynhbch (RuntimeContext $ cx , string $ name , int $ positionalCount , array $ positional , array $ hash , mixed &$ _this ): mixed
431431 {
432432 $ helper = $ cx ->helpers [$ name ] ?? null ;
433433 if ($ helper !== null ) {
434- return static ::hbch ($ cx , $ helper , $ name , $ positional , $ hash , $ _this );
434+ return static ::hbch ($ cx , $ helper , $ name , $ positionalCount , $ positional , $ hash , $ _this );
435435 }
436436
437437 $ fn = $ _this [$ name ] ?? null ;
438438 if ($ fn instanceof \Closure) {
439- return static ::hbch ($ cx , $ fn , $ name , $ positional , $ hash , $ _this );
439+ return static ::hbch ($ cx , $ fn , $ name , $ positionalCount , $ positional , $ hash , $ _this );
440440 }
441441
442442 if (!$ positional && !$ hash ) {
443443 // No arguments: must be a helper call (e.g. sub-expression), not a property lookup.
444444 throw new \Exception ('Missing helper: " ' . $ name . '" ' );
445445 }
446446
447- return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , $ positional , $ hash , $ _this );
447+ return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , $ positionalCount , $ positional , $ hash , $ _this );
448448 }
449449
450450 /**
@@ -454,7 +454,7 @@ public static function dynhbch(RuntimeContext $cx, string $name, array $position
454454 * @param array<string, mixed> $hash
455455 * @param mixed $_this current rendering context for the helper
456456 */
457- public static function hbch (RuntimeContext $ cx , \Closure $ helper , string $ name , array $ positional , array $ hash , mixed &$ _this ): mixed
457+ public static function hbch (RuntimeContext $ cx , \Closure $ helper , string $ name , int $ positionalCount , array $ positional , array $ hash , mixed &$ _this ): mixed
458458 {
459459 /** @var \WeakMap<\Closure, int>|null $paramCounts */
460460 static $ paramCounts = null ;
@@ -469,7 +469,7 @@ public static function hbch(RuntimeContext $cx, \Closure $helper, string $name,
469469 $ numParams = $ params && end ($ params )->isVariadic () ? 0 : $ rf ->getNumberOfParameters ();
470470 $ paramCounts [$ helper ] = $ numParams ;
471471 }
472- if ($ numParams === 0 || $ numParams > count ( $ positional ) ) {
472+ if ($ numParams === 0 || $ numParams > $ positionalCount ) {
473473 $ positional [] = new HelperOptions (
474474 scope: $ _this ,
475475 data: $ cx ->frame ,
0 commit comments