diff --git a/src/Knp/Menu/Twig/MenuExtension.php b/src/Knp/Menu/Twig/MenuExtension.php index 9829cfe0..3fc3df3d 100644 --- a/src/Knp/Menu/Twig/MenuExtension.php +++ b/src/Knp/Menu/Twig/MenuExtension.php @@ -150,6 +150,6 @@ public function isAncestor(ItemInterface $item, ?int $depth = null): bool public function spaceless(string $content): string { - return trim(preg_replace('/>\s+<', $content)); + return trim((string) preg_replace('/>\s+<', $content)); } }