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 28, 2023
1 parent f635d19 commit 2d938a1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/AmqpBundle/Amqp/AbstractAmqp.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ abstract class AbstractAmqp
* @param string $command The command name
* @param array $arguments Args of the command
* @param mixed $return Return value of the command
* @param int $time Exec time
* @param float $time Exec time
*/
protected function notifyEvent(string $command, array $arguments, $return, int $time = 0)
protected function notifyEvent(string $command, array $arguments, $return, float $time = 0)
{
if ($this->eventDispatcher) {
$event = new $this->eventClass();
Expand Down
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
2 changes: 1 addition & 1 deletion src/AmqpBundle/Event/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class Command extends Event implements DispatcherInterface
{
protected int $executionTime = 0;
protected float $executionTime = 0.0;
protected string $command;
protected array $arguments;

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 2d938a1

Please sign in to comment.