diff --git a/packages/framework/src/Support/Includes.php b/packages/framework/src/Support/Includes.php index 9eb9f5c43a4..93cb4f62417 100644 --- a/packages/framework/src/Support/Includes.php +++ b/packages/framework/src/Support/Includes.php @@ -66,7 +66,7 @@ public static function get(string $filename, ?string $default = null): ?string */ public static function html(string $filename, ?string $default = null): ?HtmlString { - return static::getInclude('renderHtml', '.html', $default, $filename); + return static::getInclude([static::class, 'renderHtml'], '.html', $default, $filename); } /** @@ -78,7 +78,7 @@ public static function html(string $filename, ?string $default = null): ?HtmlStr */ public static function markdown(string $filename, ?string $default = null): ?HtmlString { - return static::getInclude('renderMarkdown', '.md', $default, $filename); + return static::getInclude([static::class, 'renderMarkdown'], '.md', $default, $filename); } /** @@ -90,7 +90,7 @@ public static function markdown(string $filename, ?string $default = null): ?Htm */ public static function blade(string $filename, ?string $default = null): ?HtmlString { - return static::getInclude('renderBlade', '.blade.php', $default, $filename); + return static::getInclude([static::class, 'renderBlade'], '.blade.php', $default, $filename); } protected static function normalizePath(string $filename, string $extension): string @@ -122,7 +122,7 @@ protected static function getFileContents(string $path): ?string return Filesystem::get($path); } - protected static function getInclude(string $method, string $extension, ?string $default, string $filename): ?HtmlString + protected static function getInclude(callable $method, string $extension, ?string $default, string $filename): ?HtmlString { $path = static::normalizePath($filename, $extension); $contents = static::getFileContents($path); @@ -131,6 +131,6 @@ protected static function getInclude(string $method, string $extension, ?string return null; } - return static::$method($contents ?? $default); + return $method($contents ?? $default); } }