Skip to content

Commit

Permalink
make method static and internal
Browse files Browse the repository at this point in the history
  • Loading branch information
garak committed Feb 21, 2025
1 parent 5985c15 commit 6371b22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Knp/Menu/Twig/MenuExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getFilters(): array

return [
new TwigFilter('knp_menu_as_string', $legacy ? [$this, 'pathAsString'] : [MenuRuntimeExtension::class, 'pathAsString']),
new TwigFilter('knp_menu_spaceless', [$this, 'spaceless'], ['is_safe' => ['html']]),
new TwigFilter('knp_menu_spaceless', [self::class, 'spaceless'], ['is_safe' => ['html']]),
];
}

Expand Down Expand Up @@ -123,7 +123,10 @@ public function isAncestor(ItemInterface $item, ?int $depth = null): bool
return $this->runtimeExtension->isAncestor($item, $depth);
}

public function spaceless(string $content): string
/**
* @internal
*/
public static function spaceless(string $content): string
{
return trim((string) preg_replace('/>\s+</', '><', $content));
}
Expand Down

0 comments on commit 6371b22

Please sign in to comment.