private function onCurrentTransactionAboutToEnd()

in agent/php/ElasticApm/Impl/InferredSpansManager.php [221:255]


    private function onCurrentTransactionAboutToEnd(Transaction $transaction): void
    {
        ($loggerProxy = $this->logger->ifTraceLevelEnabled(__LINE__, __FUNCTION__))
        && $loggerProxy->log('Entered', ['transaction' => $transaction]);

        if ($this->isShutdown()) {
            return;
        }

        ($assertProxy = Assert::ifEnabled())
        && $assertProxy->that($this->currentTransaction === $transaction)
        && $assertProxy->withContext(
            '$this->currentTransaction === $transaction',
            ['this' => $this, 'transaction' => $transaction]
        );

        $this->flushAndPause();

        ($assertProxy = Assert::ifEnabled())
        && $assertProxy->that($this->onCurrentTransactionAboutToEndCallback !== null)
        && $assertProxy->withContext('$this->onTransactionAboutToEndCallback !== null', ['this' => $this]);
        /* @phpstan-ignore-next-line */
        $this->currentTransaction->onAboutToEnd->remove($this->onCurrentTransactionAboutToEndCallback);
        $this->onCurrentTransactionAboutToEndCallback = null;

        ($assertProxy = Assert::ifEnabled())
        && $assertProxy->that($this->onCurrentSpanChangedCallback !== null)
        && $assertProxy->withContext('$this->onCurrentSpanChangedCallback !== null', ['this' => $this]);
        /* @phpstan-ignore-next-line */
        $this->currentTransaction->onCurrentSpanChanged->remove($this->onCurrentSpanChangedCallback);
        $this->onCurrentSpanChangedCallback = null;
        $this->currentTransaction = null;

        $this->state = self::STATE_WAITING_FOR_NEW_TRANSACTION;
    }