#1146·predis

Second parameter of lpush should be variable-length argument list

Author: kwiduaCreated Feb 13, 2023Updated Apr 22, 2026
Labelsbugdocumentation

Describe the bug When calling lpush($key, json_encode($values)) I get a psalm error Argument 2 of lpush expects array<array-key, mixed>, but false|non-empty-string provided. The ClientInterface defines the method as * @method int lpush($key, array $values) but it should be * @method int lpush($key, ...$values).

In your test you also do not pass an array as $values, but a string: $redis->lpush('metavars', 'foo');

Some other functions in the ClientInterface are probably affected as well (lpushx, rpush..).

Versions (please complete the following information):

  • Predis: [1.1.10]
  • PHP [ 8.1.x]
  • Redis Server [e.g. 6.0.0]
  • OS [Ubuntu 20.04]