Skip to content

Commit

Permalink
Refactor to use strict types
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 24, 2024
1 parent 9a08865 commit c8007ba
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ class DynamicMarkdownLinkProcessor implements MarkdownPostProcessorContract
{
public static function postprocess(string $html): string
{
/** @var array<string, callable(array<int, string>): string> $patterns */
$patterns = [
'/<a href="hyde::route\(\'([^\']+)\'\)"/' => function ($matches) {
return '<a href="'.Hyde::route($matches[1]).'"';
'/<a href="hyde::route\(\'([^\']+)\'\)"/' => function (array $matches): string {
return '<a href="' . Hyde::route($matches[1]) . '"';
},
'/<a href="hyde::relativeLink\(\'([^\']+)\'\)"/' => function ($matches) {
return '<a href="'.Hyde::relativeLink($matches[1]).'"';
'/<a href="hyde::relativeLink\(\'([^\']+)\'\)"/' => function (array $matches): string {
return '<a href="' . Hyde::relativeLink($matches[1]) . '"';
},
'/<img src="hyde::asset\(\'([^\']+)\'\)"/' => function ($matches) {
return '<img src="'.Hyde::asset($matches[1]).'"';
'/<img src="hyde::asset\(\'([^\']+)\'\)"/' => function (array $matches): string {
return '<img src="' . Hyde::asset($matches[1]) . '"';
},
];

Expand Down

0 comments on commit c8007ba

Please sign in to comment.