diff --git a/src/Logger/Log.php b/src/Logger/Log.php index e98ead6..46f6abe 100644 --- a/src/Logger/Log.php +++ b/src/Logger/Log.php @@ -382,15 +382,22 @@ public function setMasked(array $masked): void $this->masked = $masked; } + /** + * @template T + * + * @param array $data + * @return array + */ private function mask(array $data): array { $masked = []; foreach ($data as $key => $value) { - if (is_string($key) && in_array($key, $this->masked, true)) { + if (is_string($value) && in_array($key, $this->masked, true)) { $masked[$key] = str_repeat('*', strlen($value)); } elseif (is_array($value)) { - $masked[$key] = $this->mask($value); + $maskedValue = $this->mask($value); /** @var T $maskedValue */ + $masked[$key] = $maskedValue; } else { $masked[$key] = $value; }