Skip to content

allow Redis::connect() to have 7 parameters #9413

@thomas-0816

Description

@thomas-0816

Bug report

v1.10.18

            $redis = new Redis();
            $redis->connect(
                $config->redisHost, $config->redisPort, 3, null, 100, 0,
                ['auth' => [$config->redisUsername, $config->redisPassword]]
            );

gives:

Method Redis::connect() invoked with 7 parameters, 1-6 required.

https://github.com/phpstan/phpstan-src/blob/1.11.x/resources/functionMap.php defines 6 parameters:

'Redis::connect' => ['bool', 'host'=>'string', 'port='=>'int', 'timeout='=>'float', 'persistent_id='=>'?string', 'retry_interval='=>'?int', 'read_timeout='=>'float'],

https://github.com/phpredis/phpredis/blob/develop/redis.stub.php defines 7 parameters:

public function connect(string $host, int $port = 6379, float $timeout = 0, string $persistent_id = null,
                            int $retry_interval = 0, float $read_timeout = 0, array $context = null): bool;

https://github.com/phpredis/phpredis/blob/develop/README.md gives an auth example:

/* With PhpRedis >= 5.3.0 you can specify authentication and stream information on connect */
$redis->connect('127.0.0.1', 6379, 1, '', 0, 0, ['auth' => ['phpredis', 'phpredis']]);

https://github.com/phpredis/phpredis/blob/develop/tests/RedisTest.php gives a stream example:

$redis->connect('tls://' . $host, 6378, 0, null, 0, 0, [
                'stream' => ['verify_peer_name' => $verify, 'verify_peer' => false]
            ])

It would be great if 7 parameters for Redis::connect would not create an issue.

https://phpstan.org/r/8d18a58f-b698-4e34-a626-6555a44908d3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions