Conditions | 2 |
Paths | 1 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
44 | public function publish($data, $routingKey = '', array $headers = []) |
||
45 | { |
||
46 | $response = null; |
||
47 | $correlationId = uniqid(); |
||
48 | $replyTo = $this->driver->declareSimpleQueue('', Driver::QUEUE_EXCLUSIVE); |
||
49 | |||
50 | $this->driver->publish( |
||
51 | $this->exchangeName, |
||
52 | new Message($data, $routingKey, $headers, $correlationId, $replyTo) |
||
|
|||
53 | ); |
||
54 | |||
55 | $this->driver->consume( |
||
56 | $replyTo, |
||
57 | function (Message $message) use ($replyTo, $correlationId, &$response) { |
||
58 | if ($message->getCorrelationId() == $correlationId) { |
||
59 | $response = $message->getBody(); |
||
60 | return QueueHandler::STOP_CONSUMING; |
||
61 | } |
||
62 | return QueueHandler::CONTINUE_CONSUMING; |
||
63 | }, |
||
64 | $this->timeout |
||
65 | ); |
||
66 | |||
67 | return $response; |
||
68 | } |
||
69 | } |
||
70 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: