Skip to content

Commit e313994

Browse files
committed
updated many definitions with missing @return docs
1 parent dd9f759 commit e313994

File tree

1 file changed

+63
-19
lines changed

1 file changed

+63
-19
lines changed

src/Redis.php

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
* @author Max Kamashev <[email protected]>
55
* @link https://github.com/ukko/phpredis-phpdoc
66
*
7-
* @method echo string $string Sends a string to Redis, which replies with the same string
7+
* @method echo ( $string )
8+
* Sends a string to Redis, which replies with the same string
9+
* @param string $string Sends a string to Redis, which replies with the same string
10+
* @return string
811
*
9-
* @method eval( $script, $args = array(), $numKeys = 0 )
12+
* @method eval( $script, $args = array(), $numKeys = 0 )
1013
* Evaluate a LUA script serverside
1114
* @param string $script
1215
* @param array $args
@@ -132,24 +135,44 @@ public function open( $host, $port = 6379, $timeout = 0.0 ) {}
132135
* @return bool TRUE on success, FALSE on error.
133136
* @example
134137
* <pre>
135-
* $redis->connect('127.0.0.1', 6379);
136-
* $redis->connect('127.0.0.1'); // port 6379 by default
137-
* $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
138-
* $redis->connect('/tmp/redis.sock'); // unix domain socket.
138+
* $redis->pconnect('127.0.0.1', 6379);
139+
* $redis->pconnect('127.0.0.1'); // port 6379 by default
140+
* $redis->pconnect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
141+
* $redis->pconnect('/tmp/redis.sock'); // unix domain socket.
139142
* </pre>
140143
*/
141144
public function pconnect( $host, $port = 6379, $timeout = 0.0 ) {}
142145

143146
/**
144-
* @see pconnect()
145-
* @param string $host
146-
* @param int $port
147-
* @param float $timeout
147+
* Connects to a Redis instance or reuse a connection already established with pconnect/popen.
148+
*
149+
* The connection will not be closed on close or end of request until the php process ends.
150+
* So be patient on to many open FD's (specially on redis server side) when using persistent connections on
151+
* many servers connecting to one redis server.
152+
*
153+
* Also more than one persistent connection can be made identified by either host + port + timeout
154+
* or unix socket + timeout.
155+
*
156+
* This feature is not available in threaded versions. pconnect and popen then working like their non persistent
157+
* equivalents.
158+
*
159+
* @param string $host can be a host, or the path to a unix domain socket
160+
* @param int $port optional
161+
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
162+
* @return bool TRUE on success, FALSE on error.
163+
* @example
164+
* <pre>
165+
* $redis->pconnect('127.0.0.1', 6379);
166+
* $redis->pconnect('127.0.0.1'); // port 6379 by default
167+
* $redis->pconnect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
168+
* $redis->pconnect('/tmp/redis.sock'); // unix domain socket.
169+
* </pre>
148170
*/
149171
public function popen( $host, $port = 6379, $timeout = 0.0 ) {}
150172

151173
/**
152174
* Disconnects from the Redis instance, except when pconnect is used.
175+
* @return bool
153176
*/
154177
public function close( ) {}
155178

@@ -192,7 +215,8 @@ public function ping( ) {}
192215
* Get the value related to the specified key
193216
*
194217
* @param string $key
195-
* @return string|bool: If key didn't exist, FALSE is returned. Otherwise, the value related to this key is returned.
218+
* @return mixed|bool: If key didn't exist, FALSE is returned. Otherwise, the value related to this key is returned.
219+
* If Redis::OPT_SERIALIZER has been set return value will depend on the data stored
196220
* @link http://redis.io/commands/get
197221
* @example $redis->get('key');
198222
*/
@@ -299,20 +323,22 @@ public function multi( $mode = Redis::MULTI ) {}
299323
/**
300324
* @see multi()
301325
* @link http://redis.io/commands/exec
326+
* @return bool[] the results of each operation
302327
*/
303328
public function exec( ) {}
304329

305330
/**
306331
* @see multi()
307332
* @link http://redis.io/commands/discard
333+
* @return bool
308334
*/
309335
public function discard( ) {}
310336

311337
/**
312338
* Watches a key for modifications by another client. If the key is modified between WATCH and EXEC,
313339
* the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client.
314340
* @param string | array $key: a list of keys
315-
* @return void
341+
* @return bool
316342
* @link http://redis.io/commands/watch
317343
* @example
318344
* <pre>
@@ -328,6 +354,7 @@ public function watch( $key ) {}
328354

329355
/**
330356
* @see watch()
357+
* @return bool
331358
* @link http://redis.io/commands/unwatch
332359
*/
333360
public function unwatch( ) {}
@@ -369,7 +396,7 @@ public function subscribe( $channels, $callback ) {}
369396
* @param array $patterns The number of elements removed from the set.
370397
* @param string|array $callback Either a string or an array with an object and method.
371398
* The callback will get four arguments ($redis, $pattern, $channel, $message)
372-
* @param mixed Any non-null return value in the callback will be returned to the caller.
399+
* @return mixed Any non-null return value in the callback will be returned to the caller.
373400
* @link http://redis.io/commands/psubscribe
374401
* @example
375402
* <pre>
@@ -760,6 +787,8 @@ public function lLen( $key ) {}
760787
/**
761788
* @see lLen()
762789
* @param string $key
790+
* @return int The size of the list identified by Key exists.
791+
* bool FALSE if the data type identified by Key is not list
763792
* @link http://redis.io/commands/llen
764793
*/
765794
public function lSize( $key ) {}
@@ -790,6 +819,7 @@ public function lIndex( $key, $index ) {}
790819
* @see lIndex()
791820
* @param string $key
792821
* @param int $index
822+
* @return String the element at this index
793823
* @link http://redis.io/commands/lindex
794824
*/
795825
public function lGet( $key, $index ) {}
@@ -842,6 +872,7 @@ public function lRange( $key, $start, $end ) {}
842872
* @param string $key
843873
* @param int $start
844874
* @param int $end
875+
* @return array containing the values in specified range.
845876
*/
846877
public function lGetRange( $key, $start, $end ) {}
847878

@@ -872,6 +903,7 @@ public function lTrim( $key, $start, $stop ) {}
872903
* @param string $key
873904
* @param int $start
874905
* @param int $stop
906+
* @return array Bool return FALSE if the key identify a non-list value.
875907
*/
876908
public function listTrim( $key, $start, $stop ) {}
877909

@@ -908,6 +940,7 @@ public function lRem( $key, $value, $count ) {}
908940
* @param string $key
909941
* @param string $value
910942
* @param int $count
943+
* @return int the number of elements to remove
911944
*/
912945
public function lRemove( $key, $value, $count ) {}
913946

@@ -992,6 +1025,7 @@ public function sRem( $key, $member1, $member2 = null, $memberN = null ) {}
9921025
* @param string $member1
9931026
* @param string $member2
9941027
* @param string $memberN
1028+
* @return int The number of elements removed from the set.
9951029
*/
9961030
public function sRemove( $key, $member1, $member2 = null, $memberN = null ) {}
9971031

@@ -1043,6 +1077,7 @@ public function sIsMember( $key, $value ) {}
10431077
* @link http://redis.io/commands/sismember
10441078
* @param string $key
10451079
* @param string $value
1080+
* @return bool TRUE if value is a member of the set at key key, FALSE otherwise.
10461081
*/
10471082
public function sContains( $key, $value ) {}
10481083

@@ -1355,6 +1390,7 @@ public function sMembers( $key ) {}
13551390
/**
13561391
* @see sMembers()
13571392
* @param string $key
1393+
* @return array An array of elements, the contents of the set.
13581394
* @link http://redis.io/commands/smembers
13591395
*/
13601396
public function sGetMembers( $key ) {}
@@ -1466,6 +1502,7 @@ public function rename( $srcKey, $dstKey ) {}
14661502
* @link http://redis.io/commands/rename
14671503
* @param string $srcKey
14681504
* @param string $dstKey
1505+
* @return bool: TRUE in case of success, FALSE in case of failure.
14691506
*/
14701507
public function renameKey( $srcKey, $dstKey ) {}
14711508

@@ -1494,7 +1531,7 @@ public function renameNx( $srcKey, $dstKey ) {}
14941531
*
14951532
* @param string $key The key that will disappear.
14961533
* @param int $ttl The key's remaining Time To Live, in seconds.
1497-
* @return bool: TRUE in case of success, FALSE in case of failure.
1534+
* @return bool TRUE in case of success, FALSE in case of failure.
14981535
* @link http://redis.io/commands/expire
14991536
* @example
15001537
* <pre>
@@ -1511,7 +1548,7 @@ public function expire( $key, $ttl ) {}
15111548
*
15121549
* @param string $key The key that will disappear.
15131550
* @param int $ttl The key's remaining Time To Live, in milliseconds.
1514-
* @return bool: TRUE in case of success, FALSE in case of failure.
1551+
* @return bool TRUE in case of success, FALSE in case of failure.
15151552
* @link http://redis.io/commands/pexpire
15161553
* @example
15171554
* <pre>
@@ -1527,6 +1564,7 @@ public function pExpire( $key, $ttl ) {}
15271564
* @see expire()
15281565
* @param string $key
15291566
* @param int $ttl
1567+
* @return bool TRUE in case of success, FALSE in case of failure.
15301568
* @link http://redis.io/commands/expire
15311569
*/
15321570
public function setTimeout( $key, $ttl ) {}
@@ -1570,7 +1608,7 @@ public function pExpireAt( $key, $timestamp ) {}
15701608
* Returns the keys that match a certain pattern.
15711609
*
15721610
* @param string $pattern pattern, using '*' as a wildcard.
1573-
* @return array of STRING: The keys that match a certain pattern.
1611+
* @return string[] The keys that match a certain pattern
15741612
* @link http://redis.io/commands/keys
15751613
* @example
15761614
* <pre>
@@ -1583,6 +1621,7 @@ public function keys( $pattern ) {}
15831621
/**
15841622
* @see keys()
15851623
* @param string $pattern
1624+
* @return string[] The keys that match a certain pattern
15861625
* @link http://redis.io/commands/keys
15871626
*/
15881627
public function getKeys( $pattern ) {}
@@ -1759,6 +1798,7 @@ public function getRange( $key, $start, $end ) {}
17591798
* @param string $key
17601799
* @param int $start
17611800
* @param int $end
1801+
* @return string: the substring
17621802
*/
17631803
public function substr( $key, $start, $end ) {}
17641804

@@ -2404,6 +2444,7 @@ public function zRemRangeByScore( $key, $start, $end ) {}
24042444
* @param string $key
24052445
* @param float $start
24062446
* @param float $end
2447+
* @return int The number of values deleted from the sorted set
24072448
*/
24082449
public function zDeleteRangeByScore( $key, $start, $end ) {}
24092450

@@ -2431,6 +2472,7 @@ public function zRemRangeByRank( $key, $start, $end ) {}
24312472
* @param string $key
24322473
* @param int $start
24332474
* @param int $end
2475+
* @return int The number of values deleted from the sorted set
24342476
* @link http://redis.io/commands/zremrangebyscore
24352477
*/
24362478
public function zDeleteRangeByRank( $key, $start, $end ) {}
@@ -2454,6 +2496,7 @@ public function zCard( $key ) {}
24542496
/**
24552497
* @see zCard()
24562498
* @param string $key
2499+
* @return int the set's cardinality
24572500
*/
24582501
public function zSize( $key ) {}
24592502

@@ -2978,9 +3021,10 @@ public function evalSha( $scriptSha, $args = array(), $numKeys = 0 ) {}
29783021

29793022
/**
29803023
* @see evalSha()
2981-
* @param string $scriptSha
2982-
* @param array $args
2983-
* @param int $numKeys
3024+
* @param string $scriptSha
3025+
* @param array $args
3026+
* @param int $numKeys
3027+
* @return mixed @see eval()
29843028
*/
29853029
public function evaluateSha( $scriptSha, $args = array(), $numKeys = 0 ) {}
29863030

0 commit comments

Comments
 (0)