[Cache] fix accepting sub-second max-lifetimes in ArrayAdapter

This commit is contained in:
Nicolas Grekas 2020-05-07 11:49:45 +02:00
parent 75e71e3bbe
commit cefa1e6e82

View File

@ -40,10 +40,10 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
/**
* @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise
*/
public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true, int $maxLifetime = 0, int $maxItems = 0)
public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true, float $maxLifetime = 0, int $maxItems = 0)
{
if (0 > $maxLifetime) {
throw new InvalidArgumentException(sprintf('Argument $maxLifetime must be a positive integer, %d passed.', $maxLifetime));
throw new InvalidArgumentException(sprintf('Argument $maxLifetime must be positive, %F passed.', $maxLifetime));
}
if (0 > $maxItems) {