Skip to content

Commit

Permalink
Force meta, data to be array
Browse files Browse the repository at this point in the history
  • Loading branch information
solcloud committed Nov 22, 2022
1 parent d127ee7 commit 1ddc9fe
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/BaseConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ protected function finishProcessing(): void

/**
* Create msg that can be published to broker
* @param mixed $meta
* @param mixed $data
* @param array $meta
* @param array $data
* @param bool $persistent
* @return Message
*/
public function createMessageHelper($meta = [], $data = [], bool $persistent = true): Message
public function createMessageHelper(array $meta = [], array $data = [], bool $persistent = true): Message
{
$properties['delivery_mode'] = ($persistent ? Message::DELIVERY_MODE_PERSISTENT : Message::DELIVERY_MODE_NON_PERSISTENT);
if (is_numeric($meta['_priority'] ?? false)) {
Expand All @@ -156,11 +156,11 @@ public function createMessageHelper($meta = [], $data = [], bool $persistent = t

/**
* Create string for use as msg body payload
* @param mixed $meta
* @param mixed $data
* @param array $meta
* @param array $data
* @return string
*/
public function createMessageBody($meta = [], $data = []): string
public function createMessageBody(array $meta = [], array $data = []): string
{
$failIfFalse = json_encode(
[
Expand Down Expand Up @@ -205,7 +205,7 @@ protected function publishCurrentMsgDataTo(string $exchange = null, string $rout
$exchange = '';
$routingKey = $this->getConsumingQueueName();
}
$this->publishMessage($this->createMessageHelper($this->meta, $this->data), $exchange, $routingKey);
$this->publishMessage($this->createMessageHelper((array)$this->meta, (array)$this->data), $exchange, $routingKey);
}

/**
Expand Down

0 comments on commit 1ddc9fe

Please sign in to comment.