diff --git a/phpstan-baseline.php b/phpstan-baseline.php index ba2ed9354d05..451c925f373a 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -3036,11 +3036,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Session/Handlers/RedisHandler.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Only booleans are allowed in a negated boolean, int given\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Session/Handlers/RedisHandler.php', -]; $ignoreErrors[] = [ 'message' => '#^Accessing offset \'HTTP_X_REQUESTED_WITH\' directly on \\$_SERVER is discouraged\\.$#', 'count' => 2, diff --git a/system/Cache/Handlers/RedisHandler.php b/system/Cache/Handlers/RedisHandler.php index 42b44cd98a96..953de2dc20be 100644 --- a/system/Cache/Handlers/RedisHandler.php +++ b/system/Cache/Handlers/RedisHandler.php @@ -245,6 +245,7 @@ public function getMetaData(string $key) if ($value !== null) { $time = Time::now()->getTimestamp(); $ttl = $this->redis->ttl(static::validateKey($key, $this->prefix)); + assert(is_int($ttl)); return [ 'expire' => $ttl > 0 ? $time + $ttl : null, diff --git a/system/Session/Handlers/RedisHandler.php b/system/Session/Handlers/RedisHandler.php index 815e3644984b..1fb87597ab8a 100644 --- a/system/Session/Handlers/RedisHandler.php +++ b/system/Session/Handlers/RedisHandler.php @@ -293,7 +293,10 @@ protected function lockSession(string $sessionID): bool $attempt = 0; do { - if (($ttl = $this->redis->ttl($lockKey)) > 0) { + $ttl = $this->redis->ttl($lockKey); + assert(is_int($ttl)); + + if ($ttl > 0) { sleep(1); continue;