@@ -423,13 +423,14 @@ public static function in(RuntimeContext $cx, string $name, Closure $partial): s
423423 }
424424
425425 /**
426- * Resolve a helper by name: check the helper registry, then the pre-resolved callable
427- * (for pathed expressions), then the current context, then fall back to helperMissing.
428- * Throws if a non-null, non-Closure value is found.
426+ * Resolve a helper by name: optionally check the helper registry, then the pre-resolved
427+ * callable, then fall back to helperMissing. Throws if a non-null, non-Closure value is found.
428+ * Pass $checkHelpers = false for scoped (./), depth (../), and data (@) paths, which resolve
429+ * from context only, matching HBS.js behaviour.
429430 */
430- public static function resolveHelper (RuntimeContext $ cx , string $ name , mixed $ callable ): Closure
431+ public static function resolveHelper (RuntimeContext $ cx , string $ name , mixed $ callable, bool $ checkHelpers = true ): Closure
431432 {
432- $ helper = $ cx ->helpers [$ name ] ?? $ callable ?? null ;
433+ $ helper = $ checkHelpers ? ( $ cx ->helpers [$ name ] ?? $ callable) : $ callable ;
433434 if ($ helper instanceof Closure) {
434435 return $ helper ;
435436 }
@@ -439,21 +440,6 @@ public static function resolveHelper(RuntimeContext $cx, string $name, mixed $ca
439440 return $ cx ->helpers ['helperMissing ' ];
440441 }
441442
442- /**
443- * Like resolveHelper but skips the helpers hash lookup — for scoped (./), depth (../),
444- * and data (@) paths which resolve from context only, matching HBS.js behaviour.
445- */
446- public static function resolveContextHelper (RuntimeContext $ cx , string $ name , mixed $ callable ): Closure
447- {
448- if ($ callable instanceof Closure) {
449- return $ callable ;
450- }
451- if ($ callable !== null ) {
452- throw new \Exception ("Expected $ name to be a function, got " . json_encode ($ callable ));
453- }
454- return $ cx ->helpers ['helperMissing ' ];
455- }
456-
457443 /**
458444 * Invoke a resolved helper Closure with positional params, hash, and a HelperOptions instance.
459445 * Used for known helpers and resolved helpers (direct hbch calls from generated code),
0 commit comments