mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 04:27:00 +00:00
Fix call to deprecated "convertToHtml" method
This commit is contained in:
committed by
Fabien Potencier
parent
bbc33772da
commit
779fdd09b4
@@ -16,14 +16,20 @@ use League\CommonMark\CommonMarkConverter;
|
||||
class LeagueMarkdown implements MarkdownInterface
|
||||
{
|
||||
private $converter;
|
||||
private $legacySupport;
|
||||
|
||||
public function __construct(CommonMarkConverter $converter = null)
|
||||
{
|
||||
$this->converter = $converter ?: new CommonMarkConverter();
|
||||
$this->legacySupport = !method_exists($this->converter, 'convert');
|
||||
}
|
||||
|
||||
public function convert(string $body): string
|
||||
{
|
||||
return $this->converter->convertToHtml($body);
|
||||
if ($this->legacySupport) {
|
||||
return $this->converter->convertToHtml($body);
|
||||
}
|
||||
|
||||
return $this->converter->convert($body);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user