Skip to content

AMQPConnection::setReadTimeout() should accept floats #8830

@derrabus

Description

@derrabus

Bug report

When passing a float value to AMQPConnection::setReadTimeout(), PHPStan complains that the method expected an integer. I believe this is a false positive.

The repository of the AMQP extension contains stub files and according to those, a float is expected:

https://github.com/php-amqp/php-amqp/blob/31381050c0dece172b0fa0e01fe7edd9e03b763b/stubs/AMQPConnection.php#L271-L282

Code snippet that reproduces the problem

<?php declare(strict_types = 1);

function setTimeout(AMQPConnection $connection): void
{
	$connection->setReadTimeout(1.337);
}

https://phpstan.org/r/00968283-bca7-4e7d-aae1-aeff08cac16a

Expected output

No error.

Did PHPStan help you today? Did it make you happy in any way?

It sure did! Keep up the good work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions