type fixes

This commit is contained in:
Yuri Kuznetsov
2022-03-22 12:37:27 +02:00
parent 1d4030b29e
commit 747d581f9a
7 changed files with 25 additions and 10 deletions
+8 -2
View File
@@ -101,6 +101,8 @@ class Module
$this->init();
}
assert($this->data !== null);
if ($key === null) {
return $this->data;
}
@@ -110,7 +112,11 @@ class Module
private function init(): void
{
if ($this->useCache && $this->dataCache->has($this->cacheKey)) {
if (
$this->useCache &&
$this->dataCache &&
$this->dataCache->has($this->cacheKey)
) {
/** @var array<string,array<string,mixed>> */
$data = $this->dataCache->get($this->cacheKey);
@@ -121,7 +127,7 @@ class Module
$this->data = $this->loadData();
if ($this->useCache) {
if ($this->useCache && $this->dataCache) {
$this->dataCache->store($this->cacheKey, $this->data);
}
}