diff --git a/composer.json b/composer.json index e4336d79..77472bc7 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,8 @@ "tests/Fake/Memcached.php", "tests/Fake/Redis.php", "tests/Fake/RedisException.php", - "tests/syslog.php" + "tests/syslog.php", + "tests-stub/load-relay.php" ] }, "config": { diff --git a/tests-stub/Relay.php b/tests-stub/Relay.php new file mode 100644 index 00000000..621c8460 --- /dev/null +++ b/tests-stub/Relay.php @@ -0,0 +1,3326 @@ +) constants. Otherwise it will + * return the string that Redis returns. + * + * @param mixed $key + * @return Relay|int|string|false + */ + #[\Relay\Attributes\RedisCommand] + public function type(mixed $key): Relay|int|string|bool {} + + /** + * Atomically returns and removes the first/last element of the list + * stored at source, and pushes the element at the first/last + * element of the list stored at destination. + * + * @param mixed $srckey + * @param mixed $dstkey + * @param string $srcpos + * @param string $dstpos + * @return Relay|string|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function lmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos): Relay|string|null|false {} + + /** + * BLMOVE is the blocking variant of LMOVE. When source contains elements, + * this command behaves exactly like LMOVE. When used inside a + * MULTI/EXEC block, this command behaves exactly like LMOVE. + * + * @param mixed $srckey + * @param mixed $dstkey + * @param string $srcpos + * @param string $dstpos + * @param float $timeout + * @return Relay|string|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function blmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos, float $timeout): Relay|string|null|false {} + + /** + * Returns the specified elements of the list stored at key. + * + * @param mixed $key + * @param int $start + * @param int $stop + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function lrange(mixed $key, int $start, int $stop): Relay|array|false {} + + /** + * Insert all the specified values at the head of the list stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function lpush(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Insert all the specified values at the tail of the list stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function rpush(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Inserts specified values at the head of the list stored at key, + * only if key already exists and holds a list. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function lpushx(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Inserts specified values at the tail of the list stored at key, + * only if key already exists and holds a list. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function rpushx(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Sets the list element at index to element. + * + * @param mixed $key + * @param int $index + * @param mixed $mem + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function lset(mixed $key, int $index, mixed $mem): Relay|bool {} + + /** + * Removes and returns the first elements of the list stored at key. + * + * @param mixed $key + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function lpop(mixed $key, int $count = 1): mixed {} + + /** + * The command returns the index of matching elements inside a Redis list. + * + * @param mixed $key + * @param mixed $value + * @param array $options + * @return Relay|int|array|false|null + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function lpos(mixed $key, mixed $value, ?array $options = null): Relay|int|array|false|null {} + + /** + * Removes and returns the last elements of the list stored at key. + * + * @param mixed $key + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function rpop(mixed $key, int $count = 1): mixed {} + + /** + * Atomically returns and removes the last element (tail) of the list stored at source, + * and pushes the element at the first element (head) of the list stored at destination. + * + * @param mixed $source + * @param mixed $dest + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function rpoplpush(mixed $source, mixed $dest): mixed {} + + /** + * Atomically returns and removes the last element (tail) of the list stored at source, + * and pushes the element at the first element (head) of the list stored at destination. + * This command will block for an element up to the provided timeout. + * + * @param mixed $source + * @param mixed $dest + * @param float $timeout + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function brpoplpush(mixed $source, mixed $dest, float $timeout): mixed {} + + /** + * BLPOP is a blocking list pop primitive. It is the blocking version of LPOP because + * it blocks the connection when there are no elements to pop from any of the given lists. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function blpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * Pop elements from a list, or block until one is available + * + * @param float $timeout + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function blmpop(float $timeout, array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * Remove and return members with scores in a sorted set or block until one is available + * + * @param float $timeout + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function bzmpop(float $timeout, array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * Pops one or more elements from the first non-empty list key from the list of provided key names. + * + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function lmpop(array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * Pops one or more elements, that are member-score pairs, from the + * first non-empty sorted set in the provided list of key names. + * + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function zmpop(array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * BRPOP is a blocking list pop primitive. It is the blocking version of RPOP because + * it blocks the connection when there are no elements to pop from any of the given lists. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function brpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function bzpopmax(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function bzpopmin(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * This is a container command for object introspection commands. + * + * @param string $op + * @param mixed $key + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function object(string $op, mixed $key): mixed {} + + /** + * Return the positions (longitude,latitude) of all the specified members + * of the geospatial index represented by the sorted set at key. + * + * @param mixed $key + * @param mixed $members,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function geopos(mixed $key, mixed ...$members): Relay|array|false {} + + /** + * Removes the first count occurrences of elements equal to element from the list stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param int $count + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function lrem(mixed $key, mixed $mem, int $count = 0): Relay|int|false {} + + /** + * Returns the element at index index in the list stored at key. + * + * @param mixed $key + * @param int $index + * @return mixed + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function lindex(mixed $key, int $index): mixed {} + + /** + * Inserts element in the list stored at key either before or after the reference value pivot. + * + * @param mixed $key + * @param string $op + * @param mixed $pivot + * @param mixed $element + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function linsert(mixed $key, string $op, mixed $pivot, mixed $element): Relay|int|false {} + + /** + * Trim an existing list so that it will contain only the specified range of elements specified. + * + * @param mixed $key + * @param int $start + * @param int $end + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function ltrim(mixed $key, int $start, int $end): Relay|bool {} + + /** + * Returns the value associated with field in the hash stored at key. + * + * @param mixed $hash + * @param mixed $member + * @return mixed + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hget(mixed $hash, mixed $member): mixed {} + + /** + * Returns the string length of the value associated with field in the hash stored at key. + * + * @param mixed $hash + * @param mixed $member + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hstrlen(mixed $hash, mixed $member): Relay|int|false {} + + /** + * Returns all fields and values of the hash stored at key. + * + * @param mixed $hash + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hgetall(mixed $hash): Relay|array|false {} + + /** + * Returns all field names in the hash stored at key. + * + * @param mixed $hash + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hkeys(mixed $hash): Relay|array|false {} + + /** + * Returns all values in the hash stored at key. + * + * @param mixed $hash + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hvals(mixed $hash): Relay|array|false {} + + /** + * Returns the values associated with the specified fields in the hash stored at key. + * + * @param mixed $hash + * @param array $members + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hmget(mixed $hash, array $members): Relay|array|false {} + + /** + * When called with just the key argument, return a random field from the hash value stored at key. + * + * @param mixed $hash + * @param array $options + * @return Relay|array|string|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hrandfield(mixed $hash, ?array $options = null): Relay|array|string|false {} + + /** + * Sets the specified fields to their respective values in the hash stored at key. + * + * @param mixed $hash + * @param array $members + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function hmset(mixed $hash, array $members): Relay|bool {} + + /** + * Returns if field is an existing field in the hash stored at key. + * + * @param mixed $hash + * @param mixed $member + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hexists(mixed $hash, mixed $member): Relay|bool {} + + /** + * Sets field in the hash stored at key to value, only if field does not yet exist. + * + * @param mixed $hash + * @param mixed $member + * @param mixed $value + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function hsetnx(mixed $hash, mixed $member, mixed $value): Relay|bool {} + + /** + * Sets field in the hash stored at key to value. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $val + * @param mixed $kvals,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function hset(mixed $key, mixed $mem, mixed $val, mixed ...$kvals): Relay|int|false {} + + /** + * Removes the specified fields from the hash stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param string $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function hdel(mixed $key, mixed $mem, string ...$mems): Relay|int|false {} + + /** + * Increments the number stored at field in the hash stored at key by increment. + * + * @param mixed $key + * @param mixed $mem + * @param int $value + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function hincrby(mixed $key, mixed $mem, int $value): Relay|int|false {} + + /** + * Increment the specified field of a hash stored at key, and representing + * a floating point number, by the specified increment. + * + * @param mixed $key + * @param mixed $mem + * @param float $value + * @return Relay|float|bool + */ + #[\Relay\Attributes\RedisCommand] + public function hincrbyfloat(mixed $key, mixed $mem, float $value): Relay|float|bool {} + + /** + * Increments the number stored at key by one. + * + * @param mixed $key + * @param int $by + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function incr(mixed $key, int $by = 1): Relay|int|false {} + + /** + * Decrements the number stored at key by one. + * + * @param mixed $key + * @param int $by + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function decr(mixed $key, int $by = 1): Relay|int|false {} + + /** + * Increments the number stored at key by increment. + * + * @param mixed $key + * @param int $value + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function incrby(mixed $key, int $value): Relay|int|false {} + + /** + * Decrements the number stored at key by decrement. + * + * @param mixed $key + * @param int $value + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function decrby(mixed $key, int $value): Relay|int|false {} + + /** + * Increment the string representing a floating point number stored at key by the specified increment. + * + * @param mixed $key + * @param float $value + * @return Relay|float|false + */ + #[\Relay\Attributes\RedisCommand] + public function incrbyfloat(mixed $key, float $value): Relay|float|false {} + + /** + * Returns the members of the set resulting from the difference between the first set and all the successive sets. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sdiff(mixed $key, mixed ...$other_keys): Relay|array|false {} + + /** + * This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination. + * If destination already exists, it is overwritten. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sdiffstore(mixed $key, mixed ...$other_keys): Relay|int|false {} + + /** + * Returns the members of the set resulting from the intersection of all the given sets. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sinter(mixed $key, mixed ...$other_keys): Relay|array|false {} + + /** + * Intersect multiple sets and return the cardinality of the result. + * + * @param array $keys + * @param int $limit + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sintercard(array $keys, int $limit = -1): Relay|int|false {} + + /** + * This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination. + * If destination already exists, it is overwritten. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sinterstore(mixed $key, mixed ...$other_keys): Relay|int|false {} + + /** + * Returns the members of the set resulting from the union of all the given sets. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sunion(mixed $key, mixed ...$other_keys): Relay|array|false {} + + /** + * This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination. + * If destination already exists, it is overwritten. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sunionstore(mixed $key, mixed ...$other_keys): Relay|int|false {} + + /** + * Subscribes to the specified channels. + * + * @param array $channels + * @param callable $callback + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function subscribe(array $channels, callable $callback): bool {} + + /** + * Unsubscribes from the given channels, or from all of them if none is given. + * + * @param array $channels + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function unsubscribe(array $channels = []): bool {} + + /** + * Subscribes to the given patterns. + * + * @param array $patterns + * @param callable $callback + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function psubscribe(array $patterns, callable $callback): bool {} + + /** + * Unsubscribes from the given patterns, or from all of them if none is given. + * + * @param array $patterns + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function punsubscribe(array $patterns = []): bool {} + + /** + * Subscribes to the specified shard channels. + * + * @param array $channels + * @param callable $callback + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function ssubscribe(array $channels, callable $callback): bool {} + + /** + * Unsubscribes from the given shard channels, or from all of them if none is given. + * + * @param array $channels + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function sunsubscribe(array $channels = []): bool {} + + /** + * Alters the last access time of a key(s). + * + * @param array|string $key_or_array + * @param mixed $more_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function touch(array|string $key_or_array, mixed ...$more_keys): Relay|int|false {} + + /** + * A pipeline block is simply transmitted faster to the server (like `MULTI`), but without any guarantee of atomicity. + * + * @return Relay|bool + */ + #[\Relay\Attributes\Local] + public function pipeline(): Relay|bool {} + + /** + * Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC. + * + * Accepts `Relay::MULTI` and `Relay::PIPELINE` modes. + * + * @param int $mode + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function multi(int $mode = 0): Relay|bool {} + + /** + * Executes all previously queued commands in a transaction and restores the connection state to normal. + * + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function exec(): Relay|array|bool {} + + /** + * Wait for the synchronous replication of all the write + * commands sent in the context of the current connection. + * + * @param int $replicas + * @param int $timeout + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function wait(int $replicas, $timeout): Relay|int|false {} + + /** + * Marks the given keys to be watched for conditional execution of a transaction. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function watch(mixed $key, mixed ...$other_keys): Relay|bool {} + + /** + * Flushes all the previously watched keys for a transaction. + * If you call EXEC or DISCARD, there's no need to manually call UNWATCH. + * + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function unwatch(): Relay|bool {} + + /** + * Flushes all previously queued commands in a transaction and restores the connection state to normal. + * If WATCH was used, DISCARD unwatches all keys watched by the connection. + * + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function discard(): bool {} + + /** + * Get the mode Relay is currently in. + * `Relay::ATOMIC`, `Relay::PIPELINE` or `Relay::MULTI`. + * + * @param bool $masked + * @return int + */ + #[\Relay\Attributes\Local] + public function getMode(bool $masked = false): int {} + + /** + * Clear the accumulated sent and received bytes. + * + * @return void + */ + #[\Relay\Attributes\Local] + public function clearBytes(): void {} + + /** + * Scan the keyspace for matching keys. + * + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @param string|null $type + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function scan(mixed &$iterator, mixed $match = null, int $count = 0, ?string $type = null): array|false {} + + /** + * Iterates fields of Hash types and their associated values. + * + * @param mixed $key + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function hscan(mixed $key, mixed &$iterator, mixed $match = null, int $count = 0): array|false {} + + /** + * Iterates elements of Sets types. + * + * @param mixed $key + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function sscan(mixed $key, mixed &$iterator, mixed $match = null, int $count = 0): array|false {} + + /** + * Iterates elements of Sorted Set types and their associated scores. + * + * @param mixed $key + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zscan(mixed $key, mixed &$iterator, mixed $match = null, int $count = 0): array|false {} + + /** + * Returns all keys matching pattern. + * + * @param mixed $pattern + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function keys(mixed $pattern): Relay|array|false {} + + /** + * Interact with the Redis slowlog. + * + * @param string $operation + * @param string $extra_args,... + * @return Relay|array|int|bool + */ + #[\Relay\Attributes\RedisCommand] + public function slowlog(string $operation, string ...$extra_args): Relay|array|int|bool {} + + /** + * Returns all the members of the set value stored at `$key`. + * + * @param mixed $set + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function smembers(mixed $set): Relay|array|false {} + + /** + * Returns if `$member` is a member of the set stored at `$key`. + * + * @param mixed $set + * @param mixed $member + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sismember(mixed $set, mixed $member): Relay|bool {} + + /** + * Returns whether each member is a member of the set stored at `$key`. + * + * @param mixed $set + * @param mixed $members,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function smismember(mixed $set, mixed ...$members): Relay|array|false {} + + /** + * Remove the specified members from the set stored at `$key`. + * + * @param mixed $set + * @param mixed $member + * @param mixed $members,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function srem(mixed $set, mixed $member, mixed ...$members): Relay|int|false {} + + /** + * Add the specified members to the set stored at `$key`. + * + * @param mixed $set + * @param mixed $member + * @param mixed $members,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sadd(mixed $set, mixed $member, mixed ...$members): Relay|int|false {} + + /** + * Sort the elements in a list, set or sorted set. + * + * @param mixed $key + * @param array $options + * @return Relay|array|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sort(mixed $key, array $options = []): Relay|array|int|false {} + + /** + * Sort the elements in a list, set or sorted set. Read-only variant of SORT. + * + * @param mixed $key + * @param array $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function sort_ro(mixed $key, array $options = []): Relay|array|false {} + + /** + * Move member from the set at source to the set at destination. + * + * @param mixed $srcset + * @param mixed $dstset + * @param mixed $member + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function smove(mixed $srcset, mixed $dstset, mixed $member): Relay|bool {} + + /** + * Removes and returns one or more random members from the set value store at `$key`. + * + * @param mixed $set + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function spop(mixed $set, int $count = 1): mixed {} + + /** + * Returns one or multiple random members from a set. + * + * @param mixed $set + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function srandmember(mixed $set, int $count = 1): mixed {} + + /** + * Returns the set cardinality (number of elements) of the set stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function scard(mixed $key): Relay|int|false {} + + /** + * Execute a script management command. + * + * @param string $command + * @param string $args,... + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function script(string $command, string ...$args): mixed {} + + /** + * Returns the length of the string value stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function strlen(mixed $key): Relay|int|false {} + + /** + * Returns the number of fields contained in the hash stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hlen(mixed $key): Relay|int|false {} + + /** + * Returns the length of the list stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function llen(mixed $key): Relay|int|false {} + + /** + * Acknowledge one or more IDs as having been processed by the consumer group. + * + * @param mixed $key + * @param string $group + * @param array $ids + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xack(mixed $key, string $group, array $ids): Relay|int|false {} + + /** + * Append a message to a stream. + * + * @param string $key + * @param string $id + * @param int $maxlen + * @param bool $approx + * @param bool $nomkstream + * @return Relay|string|false + */ + public function xadd( + string $key, + string $id, + array $values, + int $maxlen = 0, + bool $approx = false, + bool $nomkstream = false + ): Relay|string|false {} + + /** + * Claim ownership of stream message(s). + * + * @param string $key + * @param string $group + * @param string $consumer + * @param int $min_idle + * @param array $ids + * @param array $options + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function xclaim( + string $key, + string $group, + string $consumer, + int $min_idle, + array $ids, + array $options + ): Relay|array|bool {} + + /** + * Automatically take ownership of stream message(s) by metrics + * + * @param string $key + * @param string $group + * @param string $consumer + * @param int $min_idle + * @param string $start + * @param int $count + * @param bool $justid + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function xautoclaim( + string $key, + string $group, + string $consumer, + int $min_idle, + string $start, + int $count = -1, + bool $justid = false + ): Relay|bool|array {} + + /** + * Get the length of a stream. + * + * @param string $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xlen(string $key): Relay|int|false {} + + /** + * Perform utility operations having to do with consumer groups + * + * @param string $operation + * @param mixed $key + * @param string $group + * @param string $id_or_consumer + * @param bool $mkstream + * @param int $entries_read + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function xgroup( + string $operation, + mixed $key = null, + string $group = null, + string $id_or_consumer = null, + bool $mkstream = false, + int $entries_read = -2 + ): mixed {} + + /** + * Remove one or more specific IDs from a stream. + * + * @param string $key + * @param array $ids + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xdel(string $key, array $ids): Relay|int|false {} + + /** + * Retrieve information about a stream key. + * + * @param string $operation + * @param string|null $arg1 + * @param string|null $arg2 + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function xinfo(string $operation, ?string $arg1 = null, ?string $arg2 = null, int $count = -1): mixed {} + + /** + * Query pending entries in a stream. + * + * @param string $key + * @param string $group + * @param string|null $start + * @param string|null $end + * @param int $count + * @param string|null $consumer + * @param int $idle + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function xpending( + string $key, + string $group, + ?string $start = null, + ?string $end = null, + int $count = -1, + ?string $consumer = null, + int $idle = 0 + ): Relay|array|false {} + + /** + * Lists elements in a stream. + * + * @param mixed $key + * @param string $start + * @param string $end + * @param int $count = -1 + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function xrange(mixed $key, string $start, string $end, int $count = -1): Relay|array|false {} + + /** + * Get a range of entries from a STREAM ke in reverse chronological order. + * + * @param string $key + * @param string $end + * @param string $start + * @param int $count + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function xrevrange(string $key, string $end, string $start, int $count = -1): Relay|array|bool {} + + /** + * Read messages from a stream. + * + * @param array $streams + * @param int $count + * @param int $block + * @return Relay|array|bool|null + */ + #[\Relay\Attributes\RedisCommand] + public function xread(array $streams, int $count = -1, int $block = -1): Relay|array|bool|null {} + + /** + * Read messages from a stream using a consumer group. + * + * @param string $group + * @param string $consumer + * @param array $streams + * @param int $count + * @param int $block + * @return Relay|array|bool|null + */ + #[\Relay\Attributes\RedisCommand] + public function xreadgroup( + string $group, + string $consumer, + array $streams, + int $count = 1, + int $block = 1 + ): Relay|array|bool|null {} + + /** + * Truncate a STREAM key in various ways. + * + * @param string $key + * @param string $threshold + * @param bool $approx + * @param bool $minid + * @param int $limit + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xtrim( + string $key, + string $threshold, + bool $approx = false, + bool $minid = false, + int $limit = -1 + ): Relay|int|false {} + + /** + * Adds all the specified members with the specified scores to the sorted set stored at key. + * + * @param mixed $key + * @param mixed $args,... + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function zadd(mixed $key, mixed ...$args): mixed {} + + /** + * When called with just the key argument, return a random element from the sorted set value stored at key. + * If the provided count argument is positive, return an array of distinct elements. + * + * @param mixed $key + * @param array|null $options + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function zrandmember(mixed $key, ?array $options = null): mixed {} + + /** + * Returns the specified range of elements in the sorted set stored at key. + * + * @param mixed $key + * @param string $start + * @param string $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrange(mixed $key, string $start, string $end, mixed $options = null): Relay|array|false {} + + /** + * Returns the specified range of elements in the sorted set stored at key. + * + * @param mixed $key + * @param int $start + * @param int $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrange(mixed $key, int $start, int $end, mixed $options = null): Relay|array|false {} + + /** + * Returns all the elements in the sorted set at key with a score between + * min and max (including elements with score equal to min or max). + * + * @param mixed $key + * @param mixed $start + * @param mixed $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null): Relay|array|false {} + + /** + * Returns all the elements in the sorted set at key with a score between + * max and min (including elements with score equal to max or min). + * + * @param mixed $key + * @param mixed $start + * @param mixed $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null): Relay|array|false {} + + /** + * Returns all the elements in the sorted set at key with a score between + * max and min (including elements with score equal to max or min). + * + * @param mixed $dst + * @param mixed $src + * @param mixed $start + * @param mixed $end + * @param mixed $options + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrangestore(mixed $dst, mixed $src, mixed $start, mixed $end, mixed $options = null): Relay|int|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command returns all + * the elements in the sorted set at key with a value between min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @param int $offset + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrangebylex(mixed $key, mixed $min, mixed $max, int $offset = -1, int $count = -1): Relay|array|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command returns all + * the elements in the sorted set at key with a value between max and min. + * + * @param mixed $key + * @param mixed $max + * @param mixed $min + * @param int $offset + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrangebylex(mixed $key, mixed $max, mixed $min, int $offset = -1, int $count = -1): Relay|array|false {} + + /** + * Returns the rank of member in the sorted set stored at key, with the scores + * ordered from low to high. The rank (or index) is 0-based, which means + * that the member with the lowest score has rank 0. + * + * @param mixed $key + * @param mixed $rank + * @param bool $withscore + * @return Relay|array|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrank(mixed $key, mixed $rank, bool $withscore = false): Relay|array|int|false {} + + /** + * Returns the rank of member in the sorted set stored at key, with the scores + * ordered from high to low. The rank (or index) is 0-based, which means + * that the member with the highest score has rank 0. + * + * @param mixed $key + * @param mixed $rank + * @param bool $withscore + * @return Relay|array|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrank(mixed $key, mixed $rank, bool $withscore = false): Relay|array|int|false {} + + /** + * Removes the specified members from the sorted set stored at key. + * Non existing members are ignored. + * + * @param mixed $key + * @param mixed $args,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrem(mixed $key, mixed ...$args): Relay|int|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command removes all + * elements in the sorted set stored at key between the + * lexicographical range specified by min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zremrangebylex(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * Removes all elements in the sorted set stored at key with rank between + * start and stop. Both start and stop are 0 -based indexes with 0 being + * the element with the lowest score. + * + * @param mixed $key + * @param int $start + * @param int $end + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zremrangebyrank(mixed $key, int $start, int $end): Relay|int|false {} + + /** + * Removes all elements in the sorted set stored at key with + * a score between min and max (inclusive). + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zremrangebyscore(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * Returns the sorted set cardinality (number of elements) of the sorted set stored at key. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function zcard(mixed $key): Relay|int|false {} + + /** + * Returns the number of elements in the sorted set at key with a score between min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zcount(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * This command is similar to ZDIFFSTORE, but instead of storing the + * resulting sorted set, it is returned to the client. + * + * @param array $keys + * @param array $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zdiff(array $keys, ?array $options = null): Relay|array|false {} + + /** + * Computes the difference between the first and all successive + * input sorted sets and stores the result in destination. + * + * @param mixed $dst + * @param array $keys + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zdiffstore(mixed $dst, array $keys): Relay|int|false {} + + /** + * Increments the score of member in the sorted set stored at key by increment. + * + * @param mixed $key + * @param float $score + * @param mixed $mem + * @return Relay|float|false + */ + #[\Relay\Attributes\RedisCommand] + public function zincrby(mixed $key, float $score, mixed $mem): Relay|float|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command returns the + * number of elements in the sorted set at key with a value between min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zlexcount(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * Returns the scores associated with the specified members in the sorted set stored at key. + * + * @param mixed $key + * @param mixed $mems,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zmscore(mixed $key, mixed ...$mems): Relay|array|false {} + + /** + * Returns the score of member in the sorted set at key. + * + * @param mixed $key + * @param mixed $member + * @return Relay|float|false + */ + #[\Relay\Attributes\RedisCommand] + public function zscore(mixed $key, mixed $member): Relay|float|false {} + + /** + * This command is similar to ZINTERSTORE, but instead of storing + * the resulting sorted set, it is returned to the client. + * + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zinter(array $keys, ?array $weights = null, mixed $options = null): Relay|array|false {} + + /** + * Intersect multiple sorted sets and return the cardinality of the result. + * + * @param array $keys + * @param int $limit + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zintercard(array $keys, int $limit = -1): Relay|int|false {} + + /** + * Computes the intersection of numkeys sorted sets given by the + * specified keys, and stores the result in destination. + * + * @param mixed $dst + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zinterstore(mixed $dst, array $keys, ?array $weights = null, mixed $options = null): Relay|int|false {} + + /** + * This command is similar to ZUNIONSTORE, but instead of storing + * the resulting sorted set, it is returned to the client. + * + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zunion(array $keys, ?array $weights = null, mixed $options = null): Relay|array|false {} + + /** + * Computes the union of numkeys sorted sets given by the + * specified keys, and stores the result in destination. + * + * @param mixed $dst + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zunionstore(mixed $dst, array $keys, ?array $weights = null, mixed $options = null): Relay|int|false {} + + /** + * Removes and returns up to count members with the lowest + * scores in the sorted set stored at key. + * + * @param mixed $key + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zpopmin(mixed $key, int $count = 1): Relay|array|false {} + + /** + * Removes and returns up to count members with the highest + * scores in the sorted set stored at key. + * + * @param mixed $key + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zpopmax(mixed $key, int $count = 1): Relay|array|false {} + + /** + * Returns keys cached in runtime memory. + * + * @internal Temporary debug helper. Do not use. + * @return mixed + */ + #[\Relay\Attributes\Local] + public function _getKeys() {} + + /** + * Returns information about the license. + * + * @return array + */ + #[\Relay\Attributes\Local] + public static function license(): array {} +} diff --git a/tests/stubs/load-relay.php b/tests/stubs/load-relay.php new file mode 100644 index 00000000..58198f9a --- /dev/null +++ b/tests/stubs/load-relay.php @@ -0,0 +1,5 @@ +