for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cmobi\RabbitmqBundle\Rpc;
use Cmobi\RabbitmqBundle\Rpc\Exception\InvalidBodyAMQPMessageException;
use PhpAmqpLib\Message\AMQPMessage;
class BaseService implements RpcServiceInterface
{
private $request;
private $queueName;
private $rpcHandler;
/** @var array */
protected $queueOptions = [
'name' => null,
'passive' => false,
'durable' => true,
'exclusive' => false,
'auto_delete' => false, //Em caso de falha no serviço a filha se mantém para que outro processe.
'nowait' => false,
'arguments' => null,
'ticket' => null
];
public function __construct(Handler $handler, array $queueOptions, array $parameters = null)
$parameters
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$this->rpcHandler = $handler;
$this->queueName = $queueOptions['name'];
$this->queueOptions = array_merge($this->queueOptions, $queueOptions);
}
/**
* @return \Closure
* @throws InvalidBodyAMQPMessageException
*/
public function createCallback()
$callback = function (AMQPMessage $request) {
$this->request = $request;
$message = $this->getHandler()->handle($request);
$request->delivery_info['channel']->basic_publish(
$message,
'',
$request->get('reply_to')
);
$request->delivery_info['channel']->basic_ack(
$request->delivery_info['delivery_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 $callback;
public function getQueueName()
return $this->queueName;
* @return array
public function getQueueOptions()
return $this->queueOptions;
* @return AMQPMessage
public function getRequest()
return $this->request;
* @return Handler
public function getHandler()
return $this->rpcHandler;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.