From e710b3750f5ca8547198ecb3ebfc9169ee6b5688 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 19 Nov 2024 18:05:21 +0100 Subject: [PATCH] Adjust pretty name of closures on PHP 8.4 (#6351) related to https://github.com/php/php-src/pull/13550 see analog symfony change: https://github.com/symfony/symfony/pull/54614 --- src/utils/Utils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 46d673216..ef3f2d249 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -80,7 +80,7 @@ use function preg_match_all; use function preg_replace; use function shell_exec; use function spl_object_id; -use function str_ends_with; +use function str_contains; use function str_pad; use function str_split; use function str_starts_with; @@ -121,7 +121,7 @@ final class Utils{ */ public static function getNiceClosureName(\Closure $closure) : string{ $func = new \ReflectionFunction($closure); - if(!str_ends_with($func->getName(), '{closure}')){ + if(!str_contains($func->getName(), '{closure')){ //closure wraps a named function, can be done with reflection or fromCallable() //isClosure() is useless here because it just tells us if $func is reflecting a Closure object