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