Skip to content

Commit 8eb660c

Browse files
author
Willem Stuursma
committed
Small style changes
1 parent c7516e0 commit 8eb660c

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ before_install:
4141
- redis-server --port 63793 &
4242

4343
install:
44-
- composer install --no-ansi --no-progress --no-scripts --no-suggest --no-interaction
44+
- composer install --no-progress --no-scripts --no-suggest --no-interaction
4545

4646
before_script:
4747
- mysql -e 'create database test;'

classes/mutex/PHPRedisMutex.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PHPRedisMutex extends RedisMutex
2727
/**
2828
* Sets the connected Redis APIs.
2929
*
30-
* The Redis APIs needs to be connected yet. I.e. Redis::connect() was
30+
* The Redis APIs needs to be connected. I.e. Redis::connect() was
3131
* called already.
3232
*
3333
* @param array<\Redis|\RedisCluster> $redisAPIs The Redis connections.
@@ -43,9 +43,7 @@ public function __construct(array $redisAPIs, string $name, int $timeout = 3)
4343
}
4444

4545
/**
46-
* {@inheritDoc}
47-
*
48-
* @throws \malkusch\lock\exception\LockAcquireException
46+
* @throws LockAcquireException
4947
*/
5048
protected function add($redisAPI, string $key, string $value, int $expire): bool
5149
{
@@ -63,19 +61,22 @@ protected function add($redisAPI, string $key, string $value, int $expire): bool
6361
}
6462

6563
/**
66-
* {@inheritDoc}
67-
*
6864
* @param \Redis|\RedisCluster $redis The Redis or RedisCluster connection.
65+
* @throws LockReleaseException
6966
*/
7067
protected function evalScript($redis, string $script, int $numkeys, array $arguments)
7168
{
72-
for ($i = $numkeys, $iMax = count($arguments); $i < $iMax; $i++) {
73-
/* If a serializion mode such as "php" or "igbinary" is enabled, the arguments must be
69+
for ($i = $numkeys; $i < \count($arguments); $i++) {
70+
/*
71+
* If a serialization mode such as "php" or "igbinary" is enabled, the arguments must be
7472
* serialized by us, because phpredis does not do this for the eval command.
73+
*
74+
* The keys must not be serialized.
7575
*/
7676
$arguments[$i] = $redis->_serialize($arguments[$i]);
7777

78-
/* If LZF compression is enabled for the redis connection and the runtime has the LZF
78+
/*
79+
* If LZF compression is enabled for the redis connection and the runtime has the LZF
7980
* extension installed, compress the arguments as the final step.
8081
*/
8182
if ($this->hasLzfCompression($redis)) {
@@ -94,17 +95,14 @@ protected function evalScript($redis, string $script, int $numkeys, array $argum
9495
* Determines if lzf compression is enabled for the given connection.
9596
*
9697
* @param \Redis|\RedisCluster $redis Redis connection.
97-
* @return bool TRUE if lzf comression is enabled, false otherwise.
98+
* @return bool TRUE if lzf compression is enabled, false otherwise.
9899
*/
99100
private function hasLzfCompression($redis): bool
100101
{
101-
if (\defined('Redis::COMPRESSION_LZF') &&
102-
Redis::COMPRESSION_LZF === $redis->getOption(Redis::OPT_COMPRESSION) &&
103-
\function_exists('lzf_compress')
104-
) {
105-
return true;
102+
if (!\defined('Redis::COMPRESSION_LZF')) {
103+
return false;
106104
}
107105

108-
return false;
106+
return Redis::COMPRESSION_LZF === $redis->getOption(Redis::OPT_COMPRESSION);
109107
}
110108
}

tests/mutex/PHPRedisMutexTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ public function testEvalScriptFails()
135135

136136
/**
137137
* @dataProvider serializationAndCompressionModes
138-
*
139-
* @param array $serializer Serializer to test.
140-
* @param array $compressor Compressor to test.
141138
*/
142139
public function testSerializersAndCompressors($serializer, $compressor)
143140
{

0 commit comments

Comments
 (0)