Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

ClosureHelper.php

Namespace

Revolt\EventLoop\Internal

File

vendor/revolt/event-loop/src/EventLoop/Internal/ClosureHelper.php

View source
<?php

declare (strict_types=1);
namespace Revolt\EventLoop\Internal;


/** @internal */
final class ClosureHelper {
    public static function getDescription(\Closure $closure) : string {
        try {
            $reflection = new \ReflectionFunction($closure);
            $description = $reflection->name;
            if ($scopeClass = $reflection->getClosureScopeClass()) {
                $description = $scopeClass->name . '::' . $description;
            }
            if ($reflection->getFileName() && $reflection->getStartLine()) {
                $description .= " defined in " . $reflection->getFileName() . ':' . $reflection->getStartLine();
            }
            return $description;
        } catch (\ReflectionException) {
            return '???';
        }
    }

}

Classes

Title Deprecated Summary
ClosureHelper @internal
RSS feed
Powered by Drupal