diff --git a/core/lib/Drupal/Core/Template/DebugExtension.php b/core/lib/Drupal/Core/Template/DebugExtension.php index 91f51fd5e2..15696aebae 100644 --- a/core/lib/Drupal/Core/Template/DebugExtension.php +++ b/core/lib/Drupal/Core/Template/DebugExtension.php @@ -28,7 +28,7 @@ public function getFunctions(): array { // improve developer experience. // @see \Twig\Extension\DebugExtension // @see \Symfony\Component\VarDumper\VarDumper - if (class_exists($this::SYMFONY_VAR_DUMPER_CLASS)) { + if (class_exists(self::SYMFONY_VAR_DUMPER_CLASS)) { return [ new TwigFunction('dump', [self::class, 'dump'], ['needs_context' => TRUE, 'needs_environment' => TRUE, 'is_variadic' => TRUE]), ]; @@ -52,14 +52,12 @@ public static function dump(Environment $env, array $context, ...$variables): vo return; } - if (class_exists(static::SYMFONY_VAR_DUMPER_CLASS)) { + if (class_exists(self::SYMFONY_VAR_DUMPER_CLASS)) { if (func_num_args() === 2) { - call_user_func(static::SYMFONY_VAR_DUMPER_CLASS . '::dump', $context); + call_user_func(self::SYMFONY_VAR_DUMPER_CLASS . '::dump', $context); } else { - foreach ($variables as $variable) { - call_user_func(static::SYMFONY_VAR_DUMPER_CLASS . '::dump', $variable); - } + array_walk($variables, self::SYMFONY_VAR_DUMPER_CLASS . '::dump'); } } else {