has(StdoutLoggerInterface::class)) { /* @var LoggerInterface $logger */ $logger = $container->get(StdoutLoggerInterface::class); /* @var FormatterInterface $formatter */ if ($container->has(FormatterInterface::class)) { $formatter = $container->get(FormatterInterface::class); $logger->warning($formatter->format($throwable)); } else { $logger->warning(sprintf('Uncaptured exception[%s] detected in %s::%d.', get_class($throwable), $throwable->getFile(), $throwable->getLine())); } } } } }); try { return $coroutine->getId(); } catch (\Throwable $exception) { return -1; } } public static function inCoroutine(): bool { return Co::id() > 0; } }