[Messenger] Cleaning after new changes
This commit is contained in:
parent
4bc1cc7e43
commit
3d31772949
@ -44,7 +44,7 @@ class DebugCommand extends Command
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of %s)', implode(', ', array_keys($this->mapping))), null)
|
||||
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of %s)', implode(', ', array_keys($this->mapping))))
|
||||
->setDescription('Lists messages you can dispatch using the message buses')
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command displays all messages that can be
|
||||
|
@ -15,7 +15,6 @@ use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
|
||||
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
|
||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
|
||||
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
@ -33,8 +32,6 @@ use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
|
||||
*/
|
||||
class MessengerPass implements CompilerPassInterface
|
||||
{
|
||||
use PriorityTaggedServiceTrait;
|
||||
|
||||
private $handlerTag;
|
||||
private $busTag;
|
||||
private $receiverTag;
|
||||
@ -282,7 +279,7 @@ class MessengerPass implements CompilerPassInterface
|
||||
throw new RuntimeException(sprintf('Invalid middleware: service "%s" not found.', $id));
|
||||
}
|
||||
|
||||
if (($definition = $container->findDefinition($messengerMiddlewareId))->isAbstract()) {
|
||||
if ($container->findDefinition($messengerMiddlewareId)->isAbstract()) {
|
||||
$childDefinition = new ChildDefinition($messengerMiddlewareId);
|
||||
$childDefinition->setArguments($arguments);
|
||||
$container->setDefinition($messengerMiddlewareId = $busId.'.middleware.'.$id, $childDefinition);
|
||||
|
@ -90,7 +90,7 @@ class TraceableStack implements StackInterface
|
||||
return $nextMiddleware;
|
||||
}
|
||||
|
||||
public function stop()
|
||||
public function stop(): void
|
||||
{
|
||||
if (null !== $this->currentEvent && $this->stopwatch->isStarted($this->currentEvent)) {
|
||||
$this->stopwatch->stop($this->currentEvent);
|
||||
|
@ -42,7 +42,6 @@ class MessageBusTest extends TestCase
|
||||
{
|
||||
$message = new DummyMessage('Hello');
|
||||
$envelope = new Envelope($message);
|
||||
$responseFromDepthMiddleware = 1234;
|
||||
|
||||
$firstMiddleware = $this->getMockBuilder(MiddlewareInterface::class)->getMock();
|
||||
$firstMiddleware->expects($this->once())
|
||||
|
@ -29,7 +29,7 @@ class TraceableMessageBusTest extends TestCase
|
||||
|
||||
$traceableBus = new TraceableMessageBus($bus);
|
||||
$line = __LINE__ + 1;
|
||||
$this->assertInstanceOf(Envelope::class, $traceableBus->dispatch($message));
|
||||
$traceableBus->dispatch($message);
|
||||
$this->assertCount(1, $tracedMessages = $traceableBus->getDispatchedMessages());
|
||||
$this->assertArraySubset(array(
|
||||
'message' => $message,
|
||||
@ -52,7 +52,7 @@ class TraceableMessageBusTest extends TestCase
|
||||
|
||||
$traceableBus = new TraceableMessageBus($bus);
|
||||
$line = __LINE__ + 1;
|
||||
$this->assertInstanceOf(Envelope::class, $traceableBus->dispatch($envelope));
|
||||
$traceableBus->dispatch($envelope);
|
||||
$this->assertCount(1, $tracedMessages = $traceableBus->getDispatchedMessages());
|
||||
$this->assertArraySubset(array(
|
||||
'message' => $message,
|
||||
|
@ -56,7 +56,7 @@ class AmqpExtIntegrationTest extends TestCase
|
||||
|
||||
$receivedMessages = 0;
|
||||
$receiver->receive(function (?Envelope $envelope) use ($receiver, &$receivedMessages, $first, $second) {
|
||||
$this->assertEquals(0 == $receivedMessages ? $first : $second, $envelope);
|
||||
$this->assertEquals(0 === $receivedMessages ? $first : $second, $envelope);
|
||||
|
||||
if (2 === ++$receivedMessages) {
|
||||
$receiver->stop();
|
||||
|
@ -28,6 +28,6 @@ class SendersLocatorTest extends TestCase
|
||||
));
|
||||
|
||||
$this->assertSame(array($sender), iterator_to_array($locator->getSenders(new Envelope(new DummyMessage('a')))));
|
||||
$this->assertSame(array(), iterator_to_array($locator->getSenders(new Envelope(new SecondMessage('b')))));
|
||||
$this->assertSame(array(), iterator_to_array($locator->getSenders(new Envelope(new SecondMessage()))));
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ class Serializer implements SerializerInterface
|
||||
);
|
||||
}
|
||||
|
||||
private function decodeStamps($encodedEnvelope)
|
||||
private function decodeStamps(array $encodedEnvelope): array
|
||||
{
|
||||
$stamps = array();
|
||||
foreach ($encodedEnvelope['headers'] as $name => $value) {
|
||||
@ -113,7 +113,7 @@ class Serializer implements SerializerInterface
|
||||
return $stamps;
|
||||
}
|
||||
|
||||
private function encodeStamps(Envelope $envelope)
|
||||
private function encodeStamps(Envelope $envelope): array
|
||||
{
|
||||
if (!$stamps = $envelope->all()) {
|
||||
return array();
|
||||
|
Reference in New Issue
Block a user