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

Breadcrumb

  1. Drupal Core 11.1.x
  2. ClosureHelper.php

class ClosureHelper

@internal

Hierarchy

  • class \Revolt\EventLoop\Internal\ClosureHelper

Expanded class hierarchy of ClosureHelper

2 files declare their use of ClosureHelper
InvalidCallbackError.php in vendor/revolt/event-loop/src/EventLoop/InvalidCallbackError.php
UncaughtThrowable.php in vendor/revolt/event-loop/src/EventLoop/UncaughtThrowable.php

File

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

Namespace

Revolt\EventLoop\Internal
View source
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 '???';
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary
ClosureHelper::getDescription public static function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal