@@ -274,8 +274,10 @@ public static function createConnection(string $dsn, array $options = [])
274274 } elseif (is_a ($ class , \RedisArray::class, true )) {
275275 foreach ($ hosts as $ i => $ host ) {
276276 switch ($ host ['scheme ' ]) {
277- case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ]; break ;
278- case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ]; break ;
277+ case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ];
278+ break ;
279+ case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ];
280+ break ;
279281 default : $ hosts [$ i ] = $ host ['path ' ];
280282 }
281283 }
@@ -295,8 +297,10 @@ public static function createConnection(string $dsn, array $options = [])
295297 $ initializer = static function () use ($ class , $ params , $ dsn , $ hosts ) {
296298 foreach ($ hosts as $ i => $ host ) {
297299 switch ($ host ['scheme ' ]) {
298- case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ]; break ;
299- case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ]; break ;
300+ case 'tcp ' : $ hosts [$ i ] = $ host ['host ' ].': ' .$ host ['port ' ];
301+ break ;
302+ case 'tls ' : $ hosts [$ i ] = 'tls:// ' .$ host ['host ' ].': ' .$ host ['port ' ];
303+ break ;
300304 default : $ hosts [$ i ] = $ host ['path ' ];
301305 }
302306 }
@@ -311,9 +315,12 @@ public static function createConnection(string $dsn, array $options = [])
311315 $ redis ->setOption (\Redis::OPT_TCP_KEEPALIVE , $ params ['tcp_keepalive ' ]);
312316 }
313317 switch ($ params ['failover ' ]) {
314- case 'error ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_ERROR ); break ;
315- case 'distribute ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE ); break ;
316- case 'slaves ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES ); break ;
318+ case 'error ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_ERROR );
319+ break ;
320+ case 'distribute ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE );
321+ break ;
322+ case 'slaves ' : $ redis ->setOption (\RedisCluster::OPT_SLAVE_FAILOVER , \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES );
323+ break ;
317324 }
318325
319326 return $ redis ;
0 commit comments