phpredis-phpdoc icon indicating copy to clipboard operation
phpredis-phpdoc copied to clipboard

Invalid $value type in set commands

Open Hint-ru opened this issue 8 years ago • 2 comments

All set commands require strings for $value argument, but in fact we can pass mixed (arrays etc), because of serializers. https://github.com/ukko/phpredis-phpdoc/blob/master/src/Redis.php#L222

    /**
     * Set the string value in argument as value of the key.
     *
     * @param   string  $key
     * @param   string  $value
     * @param   int   $timeout [optional] Calling setex() is preferred if you want a timeout.
     * @return  bool    TRUE if the command is successful.
     * @link    http://redis.io/commands/set
     * @example $redis->set('key', 'value');
     */
    public function set( $key, $value, $timeout = 0 ) {}

"string $value" should be replaced with "mixed $value". For now I get false-positive "expected string" in inspections.

Proof: https://github.com/phpredis/phpredis/issues/450#issuecomment-38842459

Hint-ru avatar May 15 '17 14:05 Hint-ru

Thanks, will fix soon

ukko avatar May 17 '17 15:05 ukko

Any update on this ? the phpstorm stubs are incorrect due to this also

exussum12 avatar Jul 17 '19 05:07 exussum12