mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 07:41:43 +03:00
fix twig deprecates
This commit is contained in:
parent
a896abb3e2
commit
6946e8bdc9
@ -4,29 +4,30 @@ namespace Nelmio\ApiDocBundle\Twig\Extension;
|
|||||||
|
|
||||||
use Michelf\MarkdownExtra;
|
use Michelf\MarkdownExtra;
|
||||||
use Twig\Extension\AbstractExtension;
|
use Twig\Extension\AbstractExtension;
|
||||||
|
use Twig\TwigFilter;
|
||||||
|
|
||||||
class MarkdownExtension extends AbstractExtension
|
class MarkdownExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
protected $markdownParser;
|
private MarkdownExtra $markdownParser;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->markdownParser = new MarkdownExtra();
|
$this->markdownParser = new MarkdownExtra();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFilters()
|
public function getFilters(): array
|
||||||
{
|
{
|
||||||
return [
|
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';
|
return 'nelmio_api_doc';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function markdown($text)
|
public function markdown($text): string
|
||||||
{
|
{
|
||||||
return $this->markdownParser->transform($text);
|
return $this->markdownParser->transform($text);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user