Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 3, 2024
1 parent 7942bf1 commit 6b6e363
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/mutex/RedisMutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ abstract class RedisMutex extends SpinlockMutex implements LoggerAwareInterface
/** @var string the random value token for key identification */
private $token;

/** @var array the Redis APIs */
/** @var array<int, mixed> the Redis APIs */
private $redisAPIs;

/**
* Sets the Redis APIs.
*
* @param array $redisAPIs the Redis APIs
* @param string $name the lock name
* @param float $timeout the time in seconds a lock expires, default is 3
* @param array<int, mixed> $redisAPIs the Redis APIs
* @param string $name the lock name
* @param float $timeout the time in seconds a lock expires, default is 3
*
* @throws \LengthException the timeout must be greater than 0
*/
Expand Down Expand Up @@ -159,10 +159,10 @@ private function isMajority(int $count): bool
abstract protected function add($redisAPI, string $key, string $value, float $expire): bool;

/**
* @param mixed $redisAPI the connected Redis API
* @param string $script the Lua script
* @param int $numkeys the number of values in $arguments that represent Redis key names
* @param array $arguments keys and values
* @param mixed $redisAPI the connected Redis API
* @param string $script the Lua script
* @param int $numkeys the number of values in $arguments that represent Redis key names
* @param list<mixed> $arguments keys and values
*
* @return mixed the script result, or false if executing failed
*
Expand Down
3 changes: 2 additions & 1 deletion tests/mutex/MutexConcurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class MutexConcurrencyTest extends TestCase
{
/** @var array */
/** @var list<string> */
protected static $temporaryFiles = [];
/** @var \PDO|null the pdo instance */
private $pdo;
Expand All @@ -31,6 +31,7 @@ public static function tearDownAfterClass(): void
foreach (self::$temporaryFiles as $temporaryFile) {
unlink($temporaryFile);
}
self::$temporaryFiles = [];

parent::tearDownAfterClass();
}
Expand Down
12 changes: 10 additions & 2 deletions tests/mutex/PHPRedisMutexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
if (\PHP_MAJOR_VERSION >= 8) {
trait RedisTestTrait
{
/**
* @param list<mixed> $args
*/
#[\Override]
public function eval($script, $args = [], $numKeys = 0): mixed
{
return $this->_eval($script, $args, $numKeys);
}

/**
* @param mixed $options
*/
#[\Override]
public function set($key, $value, $options = null): /* \Redis|string| */ bool
{
Expand Down Expand Up @@ -91,8 +97,8 @@ public function close(): bool
}

/**
* @param $value mixed
* @param $timeout mixed
* @param mixed $value
* @param mixed $timeout
*
* @return \Redis|string|bool
*/
Expand All @@ -106,6 +112,8 @@ private function _set(string $key, $value, $timeout = 0)
}

/**
* @param list<mixed> $args
*
* @return mixed
*/
private function _eval(string $script, array $args = [], int $numKeys = 0)
Expand Down

0 comments on commit 6b6e363

Please sign in to comment.