@@ -232,12 +232,12 @@ public static function hv(RuntimeContext $cx, string $name, mixed &$_this): mixe
232232 {
233233 $ helper = $ cx ->helpers [$ name ] ?? null ;
234234 if ($ helper !== null ) {
235- return static ::hbch ($ cx , $ helper , $ name , [], [], $ _this );
235+ return static ::hbch ($ cx , $ helper , $ name , 0 , [], [], $ _this );
236236 }
237237 if (is_array ($ _this ) && array_key_exists ($ name , $ _this )) {
238238 return static ::dv ($ _this [$ name ]);
239239 }
240- return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , [], [], $ _this );
240+ return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , 0 , [], [], $ _this );
241241 }
242242
243243 /**
@@ -430,24 +430,24 @@ public static function in(RuntimeContext $cx, string $name, \Closure $partial):
430430 * @param array<mixed> $positional
431431 * @param array<string, mixed> $hash
432432 */
433- public static function dynhbch (RuntimeContext $ cx , string $ name , array $ positional , array $ hash , mixed &$ _this ): mixed
433+ public static function dynhbch (RuntimeContext $ cx , string $ name , int $ positionalCount , array $ positional , array $ hash , mixed &$ _this ): mixed
434434 {
435435 $ helper = $ cx ->helpers [$ name ] ?? null ;
436436 if ($ helper !== null ) {
437- return static ::hbch ($ cx , $ helper , $ name , $ positional , $ hash , $ _this );
437+ return static ::hbch ($ cx , $ helper , $ name , $ positionalCount , $ positional , $ hash , $ _this );
438438 }
439439
440440 $ fn = $ _this [$ name ] ?? null ;
441441 if ($ fn instanceof \Closure) {
442- return static ::hbch ($ cx , $ fn , $ name , $ positional , $ hash , $ _this );
442+ return static ::hbch ($ cx , $ fn , $ name , $ positionalCount , $ positional , $ hash , $ _this );
443443 }
444444
445445 if (!$ positional && !$ hash ) {
446446 // No arguments: must be a helper call (e.g. sub-expression), not a property lookup.
447447 throw new \Exception ('Missing helper: " ' . $ name . '" ' );
448448 }
449449
450- return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , $ positional , $ hash , $ _this );
450+ return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , $ positionalCount , $ positional , $ hash , $ _this );
451451 }
452452
453453 /**
@@ -457,7 +457,7 @@ public static function dynhbch(RuntimeContext $cx, string $name, array $position
457457 * @param array<string, mixed> $hash
458458 * @param mixed $_this current rendering context for the helper
459459 */
460- public static function hbch (RuntimeContext $ cx , \Closure $ helper , string $ name , array $ positional , array $ hash , mixed &$ _this ): mixed
460+ public static function hbch (RuntimeContext $ cx , \Closure $ helper , string $ name , int $ positionalCount , array $ positional , array $ hash , mixed &$ _this ): mixed
461461 {
462462 /** @var \WeakMap<\Closure, int>|null $paramCounts */
463463 static $ paramCounts = null ;
@@ -472,7 +472,7 @@ public static function hbch(RuntimeContext $cx, \Closure $helper, string $name,
472472 $ numParams = $ params && end ($ params )->isVariadic () ? 0 : $ rf ->getNumberOfParameters ();
473473 $ paramCounts [$ helper ] = $ numParams ;
474474 }
475- if ($ numParams === 0 || $ numParams > count ( $ positional ) ) {
475+ if ($ numParams === 0 || $ numParams > $ positionalCount ) {
476476 $ positional [] = new HelperOptions (
477477 scope: $ _this ,
478478 data: $ cx ->data ,
0 commit comments