@@ -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 /**
@@ -428,24 +428,24 @@ public static function in(RuntimeContext $cx, string $name, \Closure $partial):
428428 * @param array<mixed> $positional
429429 * @param array<string, mixed> $hash
430430 */
431- public static function dynhbch (RuntimeContext $ cx , string $ name , array $ positional , array $ hash , mixed &$ _this ): mixed
431+ public static function dynhbch (RuntimeContext $ cx , string $ name , int $ positionalCount , array $ positional , array $ hash , mixed &$ _this ): mixed
432432 {
433433 $ helper = $ cx ->helpers [$ name ] ?? null ;
434434 if ($ helper !== null ) {
435- return static ::hbch ($ cx , $ helper , $ name , $ positional , $ hash , $ _this );
435+ return static ::hbch ($ cx , $ helper , $ name , $ positionalCount , $ positional , $ hash , $ _this );
436436 }
437437
438438 $ fn = $ _this [$ name ] ?? null ;
439439 if ($ fn instanceof \Closure) {
440- return static ::hbch ($ cx , $ fn , $ name , $ positional , $ hash , $ _this );
440+ return static ::hbch ($ cx , $ fn , $ name , $ positionalCount , $ positional , $ hash , $ _this );
441441 }
442442
443443 if (!$ positional && !$ hash ) {
444444 // No arguments: must be a helper call (e.g. sub-expression), not a property lookup.
445445 throw new \Exception ('Missing helper: " ' . $ name . '" ' );
446446 }
447447
448- return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , $ positional , $ hash , $ _this );
448+ return static ::hbch ($ cx , $ cx ->helpers ['helperMissing ' ], $ name , $ positionalCount , $ positional , $ hash , $ _this );
449449 }
450450
451451 /**
@@ -455,7 +455,7 @@ public static function dynhbch(RuntimeContext $cx, string $name, array $position
455455 * @param array<string, mixed> $hash
456456 * @param mixed $_this current rendering context for the helper
457457 */
458- public static function hbch (RuntimeContext $ cx , \Closure $ helper , string $ name , array $ positional , array $ hash , mixed &$ _this ): mixed
458+ public static function hbch (RuntimeContext $ cx , \Closure $ helper , string $ name , int $ positionalCount , array $ positional , array $ hash , mixed &$ _this ): mixed
459459 {
460460 /** @var \WeakMap<\Closure, int>|null $paramCounts */
461461 static $ paramCounts = null ;
@@ -470,7 +470,7 @@ public static function hbch(RuntimeContext $cx, \Closure $helper, string $name,
470470 $ numParams = $ params && end ($ params )->isVariadic () ? 0 : $ rf ->getNumberOfParameters ();
471471 $ paramCounts [$ helper ] = $ numParams ;
472472 }
473- if ($ numParams === 0 || $ numParams > count ( $ positional ) ) {
473+ if ($ numParams === 0 || $ numParams > $ positionalCount ) {
474474 $ positional [] = new HelperOptions (
475475 scope: $ _this ,
476476 data: $ cx ->frame ,
0 commit comments