Skip to content

Commit

Permalink
refactor(src): simplify adding extensions in Markdown class
Browse files Browse the repository at this point in the history
  • Loading branch information
leMaur committed Aug 9, 2023
1 parent b6365ee commit 23dede0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$extension of method League\\\\CommonMark\\\\Environment\\\\Environment\\:\\:addExtension\\(\\) expects League\\\\CommonMark\\\\Extension\\\\ExtensionInterface, object given\\.$#"
count: 1
path: src/Markdown.php

-
message: "#^Call to an undefined method Illuminate\\\\View\\\\ViewFinderInterface\\:\\:getPaths\\(\\)\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function render(string $text = null): HtmlString
$environment->addExtension(new CommonMarkCoreExtension());

collect((array) config('markdown.extensions', []))
->each(fn (ExtensionInterface $extension) => $environment->addExtension(new $extension()));
->each(fn ($extension) => $environment->addExtension(new $extension()));

$converter = new MarkdownConverter($environment);
$html = $converter->convert($text)->getContent();
Expand Down

0 comments on commit 23dede0

Please sign in to comment.