From 722131d8012c257fde97bac1a621728662fe6972 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 9 Jun 2026 19:26:27 +0000 Subject: [PATCH] - Object type now show in invalid block arguments --- src/ControlStructure/BlockToken.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ControlStructure/BlockToken.php b/src/ControlStructure/BlockToken.php index f6d968b..63433ed 100644 --- a/src/ControlStructure/BlockToken.php +++ b/src/ControlStructure/BlockToken.php @@ -36,8 +36,10 @@ class BlockToken implements ControlStructure { unset(\$inlineVariables); } catch(\TypeError \$ex) { + \$showArgs = fn(\$e) => (\$type = gettype(\$e)) === 'object' ? \$e::class : \$type; + throw new \Exception( - sprintf('A block awaiting arguments `%s` instead received `%s` with values `%s`', '$arguments', implode(', ', array_map('gettype', \$inlineVariables ?? [])), json_encode(\$inlineVariables)) + sprintf('A block awaiting arguments (%s) instead received (%s) with values (%s)', '$arguments', implode(', ', array_map(\$showArgs, \$inlineVariables ?? [])), json_encode(\$inlineVariables)) ); } /*%EXCEPTION_LINE_BASE%*/?>