From 603267e7b112f1cb1590321dac38ebcd711f74dd Mon Sep 17 00:00:00 2001 From: nunoxavier Date: Thu, 20 Jun 2024 14:58:43 +0100 Subject: [PATCH] Added str macro for first and last words of a string --- src/Macros/StrMacros.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Macros/StrMacros.php b/src/Macros/StrMacros.php index b3fec98..0310fbc 100644 --- a/src/Macros/StrMacros.php +++ b/src/Macros/StrMacros.php @@ -60,7 +60,7 @@ public static function firstAndLastWords(): void ->values() ->whenNotEmpty(function (Collection $words): string { return trim($words->first().' '.$words->last()); - }, $string); + }, fn () => $string); }); }