diff --git a/src/Twig/StimulusTwigExtension.php b/src/Twig/StimulusTwigExtension.php index 2a66a28e..dd9d9d18 100644 --- a/src/Twig/StimulusTwigExtension.php +++ b/src/Twig/StimulusTwigExtension.php @@ -57,6 +57,10 @@ public function renderStimulusController(Environment $env, $dataOrControllerName $controllers[] = $controllerName; foreach ($controllerValues as $key => $value) { + if (null === $value) { + continue; + } + if (!is_scalar($value)) { $value = json_encode($value); }