Skip to content

Commit 10bae31

Browse files
committed
Fixed hypothetical type error
1 parent 06de8d6 commit 10bae31

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

lib/Phpfastcache/Extensions/Drivers/Ravendb/RavenProxy.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,21 @@ public function fromCacheItem(ExtendedCacheItemInterface $item): void
143143
}
144144

145145
/**
146-
* @return array<string, mixed>
146+
* @return null|array<string, mixed>
147147
*/
148-
public function toDriverArray(): array
149-
{
150-
return [
151-
ExtendedCacheItemPoolInterface::DRIVER_KEY_WRAPPER_INDEX => $this->key,
152-
ExtendedCacheItemPoolInterface::DRIVER_DATA_WRAPPER_INDEX => ($this->serializeData ? unserialize($this->data) : $this->data),
153-
ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX => $this->expirationDate,
154-
ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX => $this->creationDate,
155-
ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX => $this->modificationDate,
156-
TaggableCacheItemPoolInterface::DRIVER_TAGS_WRAPPER_INDEX => $this->tags,
157-
];
148+
public function toDriverArray(): ?array
149+
{
150+
if ($this->key) {
151+
return [
152+
ExtendedCacheItemPoolInterface::DRIVER_KEY_WRAPPER_INDEX => $this->key,
153+
ExtendedCacheItemPoolInterface::DRIVER_DATA_WRAPPER_INDEX => ($this->serializeData ? unserialize($this->data) : $this->data),
154+
ExtendedCacheItemPoolInterface::DRIVER_EDATE_WRAPPER_INDEX => $this->expirationDate,
155+
ExtendedCacheItemPoolInterface::DRIVER_CDATE_WRAPPER_INDEX => $this->creationDate,
156+
ExtendedCacheItemPoolInterface::DRIVER_MDATE_WRAPPER_INDEX => $this->modificationDate,
157+
TaggableCacheItemPoolInterface::DRIVER_TAGS_WRAPPER_INDEX => $this->tags,
158+
];
159+
}
160+
return null;
158161
}
159162

160163
public function setSerializeData(bool $serializeData): void

0 commit comments

Comments
 (0)