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

Breadcrumb

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

function ClosureHelper::getDescription

3 calls to ClosureHelper::getDescription()
AbstractDriver::run in vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php
Run the event loop.
InvalidCallbackError::nonNullReturn in vendor/revolt/event-loop/src/EventLoop/InvalidCallbackError.php
MUST be thrown if any callback returns a non-null value.
UncaughtThrowable::__construct in vendor/revolt/event-loop/src/EventLoop/UncaughtThrowable.php

File

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

Class

ClosureHelper
@internal

Namespace

Revolt\EventLoop\Internal

Code

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 '???';
    }
}

API Navigation

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