Skip to content

Commit 3a2cc73

Browse files
committed
refactor: fix PHPStan errors
1 parent a60c5b0 commit 3a2cc73

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,11 +3036,6 @@
30363036
'count' => 1,
30373037
'path' => __DIR__ . '/system/Session/Handlers/RedisHandler.php',
30383038
];
3039-
$ignoreErrors[] = [
3040-
'message' => '#^Only booleans are allowed in a negated boolean, int given\\.$#',
3041-
'count' => 1,
3042-
'path' => __DIR__ . '/system/Session/Handlers/RedisHandler.php',
3043-
];
30443039
$ignoreErrors[] = [
30453040
'message' => '#^Accessing offset \'HTTP_X_REQUESTED_WITH\' directly on \\$_SERVER is discouraged\\.$#',
30463041
'count' => 2,

system/Cache/Handlers/RedisHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ public function getMetaData(string $key)
245245
if ($value !== null) {
246246
$time = Time::now()->getTimestamp();
247247
$ttl = $this->redis->ttl(static::validateKey($key, $this->prefix));
248+
assert(is_int($ttl));
248249

249250
return [
250251
'expire' => $ttl > 0 ? $time + $ttl : null,

system/Session/Handlers/RedisHandler.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ protected function lockSession(string $sessionID): bool
293293
$attempt = 0;
294294

295295
do {
296-
if (($ttl = $this->redis->ttl($lockKey)) > 0) {
296+
$ttl = $this->redis->ttl($lockKey);
297+
assert(is_int($ttl));
298+
299+
if ($ttl > 0) {
297300
sleep(1);
298301

299302
continue;

0 commit comments

Comments
 (0)