Skip to content

Commit

Permalink
Merge pull request #24 from retailcrm/twig-deprecates
Browse files Browse the repository at this point in the history
fix twig deprecates
  • Loading branch information
muxx authored Oct 10, 2024
2 parents a896abb + 6946e8b commit 10ee31b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Twig/Extension/MarkdownExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,30 @@

use Michelf\MarkdownExtra;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;

class MarkdownExtension extends AbstractExtension
{
protected $markdownParser;
private MarkdownExtra $markdownParser;

public function __construct()
{
$this->markdownParser = new MarkdownExtra();
}

public function getFilters()
public function getFilters(): array
{
return [
new \Twig\TwigFilter('extra_markdown', [$this, 'markdown'], ['is_safe' => ['html']]),
new TwigFilter('extra_markdown', [$this, 'markdown'], ['is_safe' => ['html']]),
];
}

public function getName()
public function getName(): string
{
return 'nelmio_api_doc';
}

public function markdown($text)
public function markdown($text): string
{
return $this->markdownParser->transform($text);
}
Expand Down

0 comments on commit 10ee31b

Please sign in to comment.