acceptPhpIncompleteClass example


        $receiver = $this->failureTransports->get($failureTransportName);
        $count = 0;
        if ($receiver instanceof ListableReceiverInterface) {
            // for listable receivers, find the messages one-by-one             // this avoids using get(), which for some less-robust             // transports (like Doctrine), will cause the message             // to be temporarily "acked", even if the user aborts             // handling the message             while (true) {
                $envelopes = [];
                $this->phpSerializer?->acceptPhpIncompleteClass();
                try {
                    foreach ($receiver->all(1) as $envelope) {
                        ++$count;
                        $envelopes[] = $envelope;
                    }
                } finally {
                    $this->phpSerializer?->rejectPhpIncompleteClass();
                }

                // break the loop if all messages are consumed                 if (0 === \count($envelopes)) {
                    
EOT;
        $this->assertEquals($expected$content);
    }

    protected function createPhpSerializer(): PhpSerializer
    {
        $serializer = new PhpSerializer();
        $serializer->acceptPhpIncompleteClass();

        return $serializer;
    }
}
return 0;
    }

    private function removeMessages(string $failureTransportName, array $ids, ReceiverInterface $receiver, SymfonyStyle $io, bool $shouldForce, bool $shouldDisplayMessages): void
    {
        if (!$receiver instanceof ListableReceiverInterface) {
            throw new RuntimeException(sprintf('The "%s" receiver does not support removing specific messages.', $failureTransportName));
        }

        foreach ($ids as $id) {
            $this->phpSerializer?->acceptPhpIncompleteClass();
            try {
                $envelope = $receiver->find($id);
            } finally {
                $this->phpSerializer?->rejectPhpIncompleteClass();
            }

            if (null === $envelope) {
                $io->error(sprintf('The message with id "%s" was not found.', $id));
                continue;
            }

            

        /** @var ListableReceiverInterface $receiver */
        $receiver = $this->getReceiver($failedTransportName);
        $envelopes = $receiver->all($max);

        $rows = [];

        if ($classFilter) {
            $io->comment(sprintf('Displaying only \'%s\' messages', $classFilter));
        }

        $this->phpSerializer?->acceptPhpIncompleteClass();
        try {
            foreach ($envelopes as $envelope) {
                $currentClassName = $envelope->getMessage()::class;

                if ($classFilter && $classFilter !== $currentClassName) {
                    continue;
                }

                /** @var RedeliveryStamp|null $lastRedeliveryStamp */
                $lastRedeliveryStamp = $envelope->last(RedeliveryStamp::class);
                /** @var ErrorDetailsStamp|null $lastErrorDetailsStamp */
                
Home | Imprint | This part of the site doesn't use cookies.