Skip to content

Commit

Permalink
Fixed return type for RedistList::get() (#96)
Browse files Browse the repository at this point in the history
Expanded allowed types for RedistList::get to include integer.
  • Loading branch information
Bilge authored Aug 3, 2024
1 parent 0b3f38d commit a1e8cdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Command/RedisList.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ public function __construct(

/**
* @link https://redis.io/commands/lindex
*
* TODO: Change type declaration to int only in next major.
*/
public function get(string $index): string
public function get(string|int $index): ?string
{
return $this->client->execute('lindex', $this->key, $index);
}
Expand Down
1 change: 1 addition & 0 deletions test/Command/RedisListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function test(): void
$this->assertSame('y', $list->popHeadBlocking());
$this->assertSame('b', $list->popTailBlocking());

$this->assertNull($this->redis->getList('nonexistent')->get(0));
$this->assertNull($this->redis->getList('nonexistent')->popHeadBlocking(1));
$this->assertNull($this->redis->getList('nonexistent')->popTailBlocking(1));
$this->assertNull($this->redis->getList('nonexistent')->popTailPushHeadBlocking('nonexistent', 1));
Expand Down

0 comments on commit a1e8cdc

Please sign in to comment.