vyuldashev / laravel-queue-rabbitmq

RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
MIT License
1.93k stars 382 forks source link

Document the exceptions thrown by publishBasic() #593

Closed villfa closed 4 months ago

villfa commented 4 months ago

Hi,

I work on a project where we override publishBasic() like this:

try {
    parent::publishBasic($msg, $exchange, $destination, $mandatory, $immediate, $ticket);
} catch (AMQPConnectionClosedException|AMQPChannelClosedException) {
    $this->reconnect();
    parent::publishBasic($msg, $exchange, $destination, $mandatory, $immediate, $ticket);
}

but PHPStan emits this error:

Dead catch - PhpAmqpLib\Exception\AMQPChannelClosedException\|PhpAmqpLib\Exception\AMQPConnectionClosedException is never thrown in the try block.

These changes will fix this issue.