diff --git a/src/Configuration/ReplicationOption.php b/src/Configuration/ReplicationOption.php index 8352e7ce..d0efd433 100644 --- a/src/Configuration/ReplicationOption.php +++ b/src/Configuration/ReplicationOption.php @@ -42,7 +42,7 @@ class ReplicationOption implements OptionInterface if ($value === 'sentinel') { return function ($sentinels, $options) { - return new SentinelReplication($sentinels, $options->service, $options->connections); + return new SentinelReplication($options->service, $sentinels, $options->connections); }; } diff --git a/src/Connection/Aggregate/SentinelReplication.php b/src/Connection/Aggregate/SentinelReplication.php index f1cbf733..a7e7cb4a 100644 --- a/src/Connection/Aggregate/SentinelReplication.php +++ b/src/Connection/Aggregate/SentinelReplication.php @@ -101,14 +101,14 @@ class SentinelReplication implements ReplicationInterface protected $updateSentinels = false; /** - * @param array $sentinels Sentinel servers connection parameters. * @param string $service Name of the service for autodiscovery. + * @param array $sentinels Sentinel servers connection parameters. * @param ConnectionFactoryInterface $connectionFactory Connection factory instance. * @param ReplicationStrategy $strategy Replication strategy instance. */ public function __construct( - array $sentinels, $service, + array $sentinels, ConnectionFactoryInterface $connectionFactory, ReplicationStrategy $strategy = null ) { diff --git a/tests/Predis/Connection/Aggregate/SentinelReplicationTest.php b/tests/Predis/Connection/Aggregate/SentinelReplicationTest.php index a23a8fcb..fa6fcd99 100644 --- a/tests/Predis/Connection/Aggregate/SentinelReplicationTest.php +++ b/tests/Predis/Connection/Aggregate/SentinelReplicationTest.php @@ -1040,7 +1040,7 @@ class SentinelReplicationTest extends PredisTestCase $factory = new Connection\Factory(); $replication = new SentinelReplication( - array('tcp://127.0.0.1:5381?alias=sentinel1'), 'svc', $factory, $strategy + 'svc', array('tcp://127.0.0.1:5381?alias=sentinel1'), $factory, $strategy ); $this->assertSame($strategy, $replication->getReplicationStrategy()); @@ -1060,7 +1060,7 @@ class SentinelReplicationTest extends PredisTestCase $strategy = new Replication\ReplicationStrategy(); $factory = new Connection\Factory(); - $replication = new SentinelReplication(array($sentinel1), 'svc', $factory, $strategy); + $replication = new SentinelReplication('svc', array($sentinel1), $factory, $strategy); $replication->add($master); $replication->add($slave1); @@ -1091,7 +1091,7 @@ class SentinelReplicationTest extends PredisTestCase { $factory = $factory ?: new Connection\Factory(); - $replication = new SentinelReplication($sentinels, $service, $factory); + $replication = new SentinelReplication($service, $sentinels, $factory); $replication->setRetryWait(0); return $replication;