for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Burrow\Publisher;
use Burrow\Driver;
use Burrow\Message;
use Burrow\QueueHandler;
use Burrow\QueuePublisher;
class SyncPublisher implements QueuePublisher
{
/** @var Driver */
private $driver;
/** @var string */
private $exchangeName;
/** @var int */
private $timeout;
/**
* Constructor
*
* @param Driver $driver
* @param string $exchangeName
* @param int $timeout
*/
public function __construct(Driver $driver, $exchangeName, $timeout = 10)
$this->driver = $driver;
$this->exchangeName = $exchangeName;
$this->timeout = $timeout;
}
* Publish a message on the queue
* @param mixed $data
* @param string $routingKey
* @param string[] $headers
* @return mixed
public function publish($data, $routingKey = '', array $headers = [])
$response = null;
$correlationId = uniqid();
$replyTo = $this->driver->declareSimpleQueue('', Driver::QUEUE_EXCLUSIVE);
$this->driver->publish(
$this->exchangeName,
new Message($data, $routingKey, $headers, $correlationId, $replyTo)
$headers
array<integer,string>
array<integer,object<string>>
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:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
);
$this->driver->consume(
$replyTo,
function (Message $message) use ($replyTo, $correlationId, &$response) {
if ($message->getCorrelationId() == $correlationId) {
$response = $message->getBody();
return QueueHandler::STOP_CONSUMING;
return QueueHandler::CONTINUE_CONSUMING;
},
$this->timeout
return $response;
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: