8000 Minor refactor · phpredis/phpredis@e18f6c6 · GitHub
[go: up one dir, main page]

Skip to content

Commit e18f6c6

Browse files
Minor refactor
1 parent 3c125b0 commit e18f6c6

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4013,7 +4013,7 @@ _**Description**_: Subscribe to channels. Warning: this function will probably c
40134013

40144014
##### *Parameters*
40154015
*channels*: an array of channels to subscribe to
4016-
*callback*: either a string or an Array($instance, 'method_name'). The callback function receives 3 parameters: the redis instance, the channel name, and the message.
4016+
*callback*: either a string or [$instance, 'method_name']. The callback function receives 3 parameters: the redis instance, the channel name, and the message.
40174017
*return value*: Mixed. Any non-null return value in the callback will be returned to the caller.
40184018
##### *Example*
40194019
~~~php
@@ -4112,7 +4112,7 @@ $ret = $redis->multi()
41124112
->exec();
41134113

41144114
/*
4115-
$ret == Array(0 => TRUE, 1 => 'val1', 2 => TRUE, 3 => 'val2');
4115+
$ret == [0 => TRUE, 1 => 'val1', 2 => TRUE, 3 => 'val2'];
41164116
*/
41174117
~~~
41184118

cluster.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ To maintain consistency with the RedisArray class, one can create and connect to
1010
#### Declaring a cluster with an array of seeds
1111
```php
1212
// Create a cluster setting three nodes as seeds
13-
$obj_cluster = new RedisCluster(NULL, Array('host:7000', 'host:7001', 'host:7003'));
13+
$obj_cluster = new RedisCluster(NULL, ['host:7000', 'host:7001', 'host:7003']);
1414

1515
// Connect and specify timeout and read_timeout
16-
$obj_cluster = new RedisCluster(NULL, Array("host:7000", "host:7001"), 1.5, 1.5);
16+
$obj_cluster = new RedisCluster(NULL, ["host:7000", "host:7001"], 1.5, 1.5);
1717

1818
// Connect with read/write timeout as well as specify that phpredis should use
1919
// persistent connections to each node.
20-
$obj_cluster = new RedisCluster(NULL, Array("host:7000", "host:7001"), 1.5, 1.5, true);
20+
$obj_cluster = new RedisCluster(NULL, ["host:7000", "host:7001"], 1.5, 1.5, true);
2121

2222
// Connect with cluster using password.
23-
$obj_cluster = new RedisCluster(NULL, Array("host:7000", "host:7001"), 1.5, 1.5, true, "password");
23+
$obj_cluster = new RedisCluster(NULL, ["host:7000", "host:7001"], 1.5, 1.5, true, "password");
2424

2525
// Connect with cluster using SSL/TLS
2626
// last argument is an array with [SSL context](https://www.php.net/manual/en/context.ssl.php) options
27-
$obj_cluster = new RedisCluster(NULL, Array("host:7000", "host:7001"), 1.5, 1.5, true, NULL, Array("verify_peer" => false));
27+
$obj_cluster = new RedisCluster(NULL, ["host:7000", "host:7001"], 1.5, 1.5, true, NULL, Array("verify_peer" => false));
2828
```
2929

3030
#### Loading a cluster configuration by name
@@ -215,4 +215,4 @@ Following INI variables can be used to configure session compression:
215215
redis.session.compression = zstd
216216
; What compression level should be used? Compression level depends on used library. For most deployments range 1-9 should be fine. Defaults to: 3
217217
redis.session.compression_level = 3
218-
~~~
218+
~~~

redis.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,13 +1719,13 @@ PHP_METHOD(Redis, zPopMin)
17191719
}
17201720
/* }}} */
17211721

1722-
/* {{{ proto Redis::bzPopMax(Array(keys) [, timeout]): Array */
1722+
/* {{{ proto Redis::bzPopMax(Array[keys] [, timeout]): Array */
17231723
PHP_METHOD(Redis, bzPopMax) {
17241724
REDIS_PROCESS_KW_CMD("BZPOPMAX", redis_blocking_pop_cmd, redis_sock_read_multibulk_reply);
17251725
}
17261726
/* }}} */
17271727

1728-
/* {{{ proto Redis::bzPopMin(Array(keys) [, timeout]): Array */
1728+
/* {{{ proto Redis::bzPopMin([keys] [, timeout]): Array */
17291729
PHP_METHOD(Redis, bzPopMin) {
17301730
REDIS_PROCESS_KW_CMD("BZPOPMIN", redis_blocking_pop_cmd, redis_sock_read_multibulk_reply);
17311731
}
@@ -2135,31 +2135,31 @@ PHP_METHOD(Redis, publish)
21352135
}
21362136
/* }}} */
21372137

2138-
/* {{{ proto void Redis::psubscribe(Array(pattern1, pattern2, ... patternN)) */
2138+
/* {{{ proto void Redis::psubscribe([pattern1, pattern2, ... patternN]) */
21392139
PHP_METHOD(Redis, psubscribe)
21402140
{
21412141
REDIS_PROCESS_KW_CMD("PSUBSCRIBE", redis_subscribe_cmd,
21422142
redis_subscribe_response);
21432143
}
21442144
/* }}} */
21452145

2146-
/* {{{ proto void Redis::ssubscribe(Array(shardchannel1, shardchannel2, ... shardchannelN)) */
2146+
/* {{{ proto void Redis::ssubscribe([shardchannel1, shardchannel2, ... shardchannelN]) */
21472147
PHP_METHOD(Redis, ssubscribe)
21482148
{
21492149
REDIS_PROCESS_KW_CMD("SSUBSCRIBE", redis_subscribe_cmd,
21502150
redis_subscribe_response);
21512151
}
21522152
/* }}} */
21532153

2154-
/* {{{ proto void Redis::subscribe(Array(channel1, channel2, ... channelN)) */
2154+
/* {{{ proto void Redis::subscribe([channel1, channel2, ... channelN]) */
21552155
PHP_METHOD(Redis, subscribe) {
21562156
REDIS_PROCESS_KW_CMD("SUBSCRIBE", redis_subscribe_cmd,
21572157
redis_subscribe_response);
21582158
}
21592159

21602160
/**
21612161
* [ps]unsubscribe channel_0 channel_1 ... channel_n
2162-
* [ps]unsubscribe(array(channel_0, channel_1, ..., channel_n))
2162+
* [ps]unsubscribe([channel_0, channel_1, ..., channel_n])
21632163
* response format :
21642164
* array(
21652165
* channel_0 => TRUE|FALSE,

tests/RedisTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,9 @@ public function testMultiple() {
703703
$this->assertEquals(['v1', 'v2', 'v3'], $this->redis->mget(['mget1', 'mget2', 'mget3']));
704704

705705
$this->redis->set('k5', '$1111111111');
706-
$this->assertEquals([0 => '$1111111111'], $this->redis->mget(['k5']));
706+
$this->assertEquals(['$1111111111'], $this->redis->mget(['k5']));
707707

708-
$this->assertEquals([0 => 'test'], $this->redis->mget([1])); // non-string
708+
$this->assertEquals(['test'], $this->redis->mget([1])); // non-string
709709
}
710710

711711
public function testMultipleBin() {

0 commit comments

Comments
 (0)
0