public function createScopeAndRetrieveItsCloser(?TraceContext $currentContext = null): callable
    {
        $previous = $this->context;
        $self = $this;
        $this->context = $currentContext;

        return function () use ($previous, $self) {
            $self->context = $previous;
        };
    }