AymDev / MessengerAzureBundle

A Symfony 4/5/6 bundle providing a Messenger transport for Azure Service Bus using the Azure REST API.
MIT License
10 stars 7 forks source link

Argument #12 ($timeToLive) must be of type ?int, float given in AzureBrokerPropertiesStamp::__construct() #12

Open dkrizan opened 1 year ago

dkrizan commented 1 year ago

Description: While utilizing the package, I encountered an error related to type incompatibility within the constructor of AzureBrokerPropertiesStamp. The error message is:

"AymDev\MessengerAzureBundle\Messenger\Stamp\AzureBrokerPropertiesStamp::__construct(): Argument #12 ($timeToLive) must be of type ?int, float given, called in /var/app/vendor/aymdev/messenger-azure-bundle/src/Messenger/Stamp/AzureBrokerPropertiesStamp.php on line 160

The method expects $timeToLive to be either null or int, but a float value is being passed in when message is received from queue.

Steps to Reproduce:

1. Configure the `messenger.yaml` as instructions says.
2. Send message to queue from Azure portal.

Expected Behavior: The constructor should handle the provided value without a type error.

Possible Solution: Consider rounding the value to an integer before setting it to the class property $timeToLive or re-evaluating the method's signature and class property to accept float values.

AymDev commented 10 months ago

Hello !

According to this documentation:

BrokerProperties {TimeToLive} is the number of seconds of the TimeSpan (double).

I thought the "number of seconds" would have been an integer but it says "double".

Feel free to work on a PR about this issue !