From 311e21bcf30b7c37993a23c6668e9bcf7a0d03db Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 5 Jan 2023 22:17:37 +0100 Subject: [PATCH] Allow $markdown = null in 'markdown' Twig filter --- lib/PicoTwigExtension.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PicoTwigExtension.php b/lib/PicoTwigExtension.php index 61da550..9c6d7b7 100644 --- a/lib/PicoTwigExtension.php +++ b/lib/PicoTwigExtension.php @@ -115,15 +115,15 @@ class PicoTwigExtension extends AbstractTwigExtension * @see Pico::substituteFileContent() * @see Pico::parseFileContent() * - * @param string $markdown markdown to parse - * @param array $meta meta data to use for %meta.*% replacement - * @param bool $singleLine whether to parse just a single line of markup + * @param string|null $markdown markdown to parse + * @param array $meta meta data to use for %meta.*% replacement + * @param bool $singleLine whether to parse a single line of markup * * @return string parsed HTML */ - public function markdownFilter(string $markdown, array $meta = [], bool $singleLine = false): string + public function markdownFilter(?string $markdown, array $meta = [], bool $singleLine = false): string { - $markdown = $this->getPico()->substituteFileContent($markdown, $meta); + $markdown = $this->getPico()->substituteFileContent($markdown ?? '', $meta); return $this->getPico()->parseFileContent($markdown, $singleLine); }