Skip to content

Commit

Permalink
Adjust pretty name of closures on PHP 8.4 (#6351)
Browse files Browse the repository at this point in the history
related to php/php-src#13550

see analog symfony change: symfony/symfony#54614
  • Loading branch information
staabm authored Nov 19, 2024
1 parent faf1e26 commit e710b37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
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;
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e710b37

Please sign in to comment.