Skip to content

Commit

Permalink
fix: to squash
Browse files Browse the repository at this point in the history
  • Loading branch information
Yokann committed Jul 24, 2023
1 parent f635d19 commit 307cabb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/AmqpBundle/Amqp/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ public function __construct(\AMQPQueue $queue, array $queueOptions)
public function getMessage(int $flags = AMQP_AUTOACK): ?\AMQPEnvelope
{
$envelope = $this->call($this->queue, 'get', [$flags]);
$envelope = $envelope === false ? null : $envelope;

if ($this->eventDispatcher) {
$preRetrieveEvent = new PreRetrieveEvent($envelope);
$this->eventDispatcher->dispatch( $preRetrieveEvent, PreRetrieveEvent::NAME);
$this->eventDispatcher->dispatch($preRetrieveEvent, PreRetrieveEvent::NAME);

return $preRetrieveEvent->getEnvelope();
}

return $envelope === false ? null : $envelope;
return $envelope;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/AmqpBundle/Event/PreRetrieveEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ class PreRetrieveEvent extends Event
{
const NAME = 'amqp.pre_retrieve';

private AMQPEnvelope $envelope;
private ?AMQPEnvelope $envelope;

public function __construct(AMQPEnvelope $envelope)
public function __construct(?AMQPEnvelope $envelope)
{
$this->envelope = $envelope;
}

public function getEnvelope(): AMQPEnvelope
public function getEnvelope(): ?AMQPEnvelope
{
return $this->envelope;
}

public function setEnvelope(AMQPEnvelope $envelope)
public function setEnvelope(?AMQPEnvelope $envelope)
{
$this->envelope = $envelope;
}
Expand Down

0 comments on commit 307cabb

Please sign in to comment.