Skip to content
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

Fix PHPDoc return typehint in BatchConsumerInterface::batchExecute() #722

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

pavdovlatov
Copy link
Contributor

@pavdovlatov pavdovlatov commented Dec 20, 2023

Hi there! 👋

In this PR I'm suggesting to fix PHPDoc and add int as possible return types for BatchConsumerInterface::batchExecute()

The reason:

We're analyzing the result of BatchConsumerInterface::batchExecute() in:
\OldSound\RabbitMqBundle\RabbitMq\BatchConsumer::batchConsume
-> \OldSound\RabbitMqBundle\RabbitMq\BatchConsumer::handleProcessMessages
-> \OldSound\RabbitMqBundle\RabbitMq\BatchConsumer::analyzeProcessFlags
-> \OldSound\RabbitMqBundle\RabbitMq\BatchConsumer::handleProcessFlag

Inside BatchConsumer::handleProcessFlag() we can see that the value is compared against integer constants.
And inside BatchConsumer::analyzeProcessFlags() its clear that if $processFlags isn't passed as array then the value would be formed as array of $deliveryTag -> $processFlags, so initial result of BatchConsumerInterface::batchExecute() is used here.

We discovered this issue while increasing the strictness of our static code analyzer.

Thanks for your time!

@mihaileu mihaileu merged commit 7f151c6 into php-amqplib:master Dec 20, 2023
2 checks passed
@pavdovlatov pavdovlatov deleted the fix-batch-interface-phpdoc branch December 20, 2023 10:44
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.

3 participants