Skip to content

Commit 8d1660f

Browse files
authored
Fix PHP 8.5 deprecation - avoid using null as array key
This PR is backwards compatible and keeps the public API and behavior the same, but avoids the deprecation warning in PHP 8.5+.
1 parent 6dfa99c commit 8d1660f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/LogFile.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ public function type(): LogType
7575

7676
public function index(?string $query = null): LogIndex
7777
{
78-
if (! isset($this->_logIndexCache[$query])) {
79-
$this->_logIndexCache[$query] = new LogIndex($this, $query);
78+
$cacheKey = $query ?? '';
79+
80+
if (! isset($this->_logIndexCache[$cacheKey])) {
81+
$this->_logIndexCache[$cacheKey] = new LogIndex($this, $query);
8082
}
8183

82-
return $this->_logIndexCache[$query];
84+
return $this->_logIndexCache[$cacheKey];
8385
}
8486

8587
public function logs(): LogReaderInterface

0 commit comments

Comments
 (0)