for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AMQPAL\Adapter\PhpAmqpLib;
use PhpAmqpLib\Message\AMQPMessage;
class ConsumerCallback
{
/**
* @var callable
*/
protected $callback;
* @var Queue
protected $queue;
* @var MessageMapper
protected $messageMapper;
* ConsumerCallback constructor.
*
* @param callable $callback
* @param Queue $queue
public function __construct(callable $callback, Queue $queue)
$this->callback = $callback;
$this->queue = $queue;
}
* @param AMQPMessage $message
* @return mixed
* @throws \OutOfBoundsException
public function __invoke(AMQPMessage $message)
$convertedMessage = $this->getMessageMapper()->toMessage($message);
$ret = call_user_func($this->callback, $convertedMessage, $this->queue);
if (false === $ret) {
$this->queue->cancel($message->delivery_info['consumer_tag']);
$message->delivery_info['consumer_tag']
object<PhpAmqpLib\Channel\AMQPChannel>
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);
return $ret;
* @return MessageMapper
public function getMessageMapper()
if (!$this->messageMapper) {
$this->messageMapper = new MessageMapper();
return $this->messageMapper;
* @param MessageMapper $messageMapper
* @return $this
public function setMessageMapper($messageMapper)
$this->messageMapper = $messageMapper;
return $this;
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: