From 6c7449d2c9a2461728dad68826cd298886b0119c Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:26:04 +0100 Subject: [PATCH] fix: check --- src/Logger/Log.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; }