Skip to content

Document the exceptions thrown by publishBasic() #593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2024
Merged

Document the exceptions thrown by publishBasic() #593

merged 1 commit into from
Jul 8, 2024

Conversation

villfa
Copy link
Contributor

@villfa villfa commented Jul 8, 2024

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.

@khepin khepin merged commit f7a3f9d into vyuldashev:master Jul 8, 2024
10 checks passed
@villfa villfa deleted the patch-1 branch July 9, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants