From 87beefb5de6f32e845376cdceb46ae8f931d3a4a Mon Sep 17 00:00:00 2001 From: nixx Date: Tue, 3 Mar 2026 22:46:16 +0300 Subject: [PATCH] fix `hget` returned TypeError --- src/Command/RedisMap.php | 2 +- test/Command/RedisMapTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Command/RedisMap.php b/src/Command/RedisMap.php index 812386f..398d021 100644 --- a/src/Command/RedisMap.php +++ b/src/Command/RedisMap.php @@ -96,7 +96,7 @@ public function setValues(array $data): void /** * @link https://redis.io/commands/hget */ - public function getValue(string $field): string + public function getValue(string $field): ?string { return $this->client->execute('hget', $this->key, $field); } diff --git a/test/Command/RedisMapTest.php b/test/Command/RedisMapTest.php index 331931c..22866cc 100644 --- a/test/Command/RedisMapTest.php +++ b/test/Command/RedisMapTest.php @@ -15,6 +15,8 @@ public function test(): void $this->assertSame([], $map->getKeys()); $this->assertSame([], $map->getAll()); + $this->assertNull($map->getValue('foo')); + $map->setValues([ 'foo' => 'bar', 'rofl' => 'lol',