@@ -36,7 +36,7 @@  | 
                                                    ||
| 36 | 36 | protected function resolveConnection($name = null)  | 
                                                        
| 37 | 37 |      { | 
                                                        
| 38 | 38 | $name = $name ?: 'default';  | 
                                                        
| 39 | - $options = Arr::get($this->config, 'options', [ ]);  | 
                                                        |
| 39 | + $options = Arr::get($this->config, 'options', []);  | 
                                                        |
| 40 | 40 | |
| 41 | 41 |          if (isset($this->config[$name])) { | 
                                                        
| 42 | 42 | return $this->connector()->connect($this->config[$name], $options);  | 
                                                        
@@ -83,7 +83,7 @@ discard block  | 
                                                    ||
| 83 | 83 | */  | 
                                                        
| 84 | 84 | public static function normalizeConnection(array $connection)  | 
                                                        
| 85 | 85 |      { | 
                                                        
| 86 | - $normal = [ ];  | 
                                                        |
| 86 | + $normal = [];  | 
                                                        |
| 87 | 87 | |
| 88 | 88 |          if (array_key_exists('options', $connection)) { | 
                                                        
| 89 | 89 | $normal['options'] = $connection['options'];  | 
                                                        
@@ -117,7 +117,7 @@ discard block  | 
                                                    ||
| 117 | 117 | return static::normalizeHostString($host);  | 
                                                        
| 118 | 118 | }  | 
                                                        
| 119 | 119 | |
| 120 | - return [ $host ];  | 
                                                        |
| 120 | + return [$host];  | 
                                                        |
| 121 | 121 | }  | 
                                                        
| 122 | 122 | |
| 123 | 123 | /**  | 
                                                        
@@ -132,8 +132,8 @@ discard block  | 
                                                    ||
| 132 | 132 | */  | 
                                                        
| 133 | 133 | protected static function normalizeHostArray(array $hostArray)  | 
                                                        
| 134 | 134 |      { | 
                                                        
| 135 | -        if (! array_key_exists('host', $hostArray)) { | 
                                                        |
| 136 | - return [ $hostArray ];  | 
                                                        |
| 135 | +        if (!array_key_exists('host', $hostArray)) { | 
                                                        |
| 136 | + return [$hostArray];  | 
                                                        |
| 137 | 137 | }  | 
                                                        
| 138 | 138 | |
| 139 | 139 | $port = Arr::get($hostArray, 'port', 26379);  | 
                                                        
@@ -155,7 +155,7 @@ discard block  | 
                                                    ||
| 155 | 155 | */  | 
                                                        
| 156 | 156 | protected static function normalizeHostString($hostString, $port = 26379)  | 
                                                        
| 157 | 157 |      { | 
                                                        
| 158 | - $hosts = [ ];  | 
                                                        |
| 158 | + $hosts = [];  | 
                                                        |
| 159 | 159 | |
| 160 | 160 |          foreach (explode(',', $hostString) as $host) { | 
                                                        
| 161 | 161 | $host = trim($host);  | 
                                                        
@@ -163,7 +163,7 @@ discard block  | 
                                                    ||
| 163 | 163 |              if (Str::contains($host, ':')) { | 
                                                        
| 164 | 164 | $hosts[] = $host;  | 
                                                        
| 165 | 165 |              } else { | 
                                                        
| 166 | - $hosts[] = [ 'host' => $host, 'port' => $port ];  | 
                                                        |
| 166 | + $hosts[] = ['host' => $host, 'port' => $port];  | 
                                                        |
| 167 | 167 | }  | 
                                                        
| 168 | 168 | }  | 
                                                        
| 169 | 169 | |
@@ -44,11 +44,11 @@  | 
                                                    ||
| 44 | 44 | * @return PredisConnection The Sentinel connection containing a configured  | 
                                                        
| 45 | 45 | * Predis Client  | 
                                                        
| 46 | 46 | */  | 
                                                        
| 47 | - public function connect(array $server, array $options = [ ])  | 
                                                        |
| 47 | + public function connect(array $server, array $options = [])  | 
                                                        |
| 48 | 48 |      { | 
                                                        
| 49 | 49 | // Merge the global options shared by all Sentinel connections with  | 
                                                        
| 50 | 50 | // connection-specific options  | 
                                                        
| 51 | - $clientOpts = array_merge($options, Arr::pull($server, 'options', [ ]));  | 
                                                        |
| 51 | + $clientOpts = array_merge($options, Arr::pull($server, 'options', []));  | 
                                                        |
| 52 | 52 | |
| 53 | 53 | // Automatically set "replication" to "sentinel". This is the Sentinel  | 
                                                        
| 54 | 54 | // driver, after all.  | 
                                                        
@@ -47,7 +47,7 @@ discard block  | 
                                                    ||
| 47 | 47 | * @param Client $client The Redis client to wrap.  | 
                                                        
| 48 | 48 | * @param array $sentinelOptions Sentinel-specific connection options.  | 
                                                        
| 49 | 49 | */  | 
                                                        
| 50 | - public function __construct(Client $client, array $sentinelOptions = [ ])  | 
                                                        |
| 50 | + public function __construct(Client $client, array $sentinelOptions = [])  | 
                                                        |
| 51 | 51 |      { | 
                                                        
| 52 | 52 | parent::__construct($client);  | 
                                                        
| 53 | 53 | |
@@ -56,7 +56,7 @@ discard block  | 
                                                    ||
| 56 | 56 |          foreach ($sentinelOptions as $option => $value) { | 
                                                        
| 57 | 57 | DynamicMethod::parseFromUnderscore($option)  | 
                                                        
| 58 | 58 |                  ->prepend('set') | 
                                                        
| 59 | - ->callOn($this, [ $value ]);  | 
                                                        |
| 59 | + ->callOn($this, [$value]);  | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | }  | 
                                                        
| 62 | 62 | |
@@ -142,7 +142,7 @@ discard block  | 
                                                    ||
| 142 | 142 | $method = 'subscribe'  | 
                                                        
| 143 | 143 |      ) { | 
                                                        
| 144 | 144 |          $this->retryOnFailure(function () use ($method, $channels, $callback) { | 
                                                        
| 145 | - $loop = $this->pubSubLoop([ $method => (array) $channels ]);  | 
                                                        |
| 145 | + $loop = $this->pubSubLoop([$method => (array) $channels]);  | 
                                                        |
| 146 | 146 | |
| 147 | 147 |              if ($method === 'psubscribe') { | 
                                                        
| 148 | 148 | $messageKind = 'pmessage';  | 
                                                        
@@ -171,7 +171,7 @@ discard block  | 
                                                    ||
| 171 | 171 | /**  | 
                                                        
| 172 | 172 | * Create an instance of the loader and load the configuration in one step.  | 
                                                        
| 173 | 173 | *  | 
                                                        
| 174 | - * @param LaravelApplication|LumenApplication $app The current application  | 
                                                        |
| 174 | + * @param \Illuminate\Contracts\Container\Container $app The current application  | 
                                                        |
| 175 | 175 | * instance that provides context and services needed to load the  | 
                                                        
| 176 | 176 | * appropriate configuration.  | 
                                                        
| 177 | 177 | *  | 
                                                        
@@ -253,7 +253,7 @@ discard block  | 
                                                    ||
| 253 | 253 | * This helper method enables the package's service providers to get config  | 
                                                        
| 254 | 254 | * values without having to resolve the config service from the container.  | 
                                                        
| 255 | 255 | *  | 
                                                        
| 256 | - * @param string|array $key The key(s) for the value(s) to fetch.  | 
                                                        |
| 256 | + * @param string $key The key(s) for the value(s) to fetch.  | 
                                                        |
| 257 | 257 | * @param mixed $default Returned if the key does not exist.  | 
                                                        
| 258 | 258 | *  | 
                                                        
| 259 | 259 | * @return mixed The requested configuration value or the provided default  | 
                                                        
@@ -7,7 +7,6 @@  | 
                                                    ||
| 7 | 7 | use Laravel\Horizon\Horizon;  | 
                                                        
| 8 | 8 | use Laravel\Lumen\Application as LumenApplication;  | 
                                                        
| 9 | 9 | use Monospice\LaravelRedisSentinel\Configuration\HostNormalizer;  | 
                                                        
| 10 | -use Monospice\LaravelRedisSentinel\Manager;  | 
                                                        |
| 11 | 10 | use UnexpectedValueException;  | 
                                                        
| 12 | 11 | |
| 13 | 12 | /**  | 
                                                        
@@ -165,7 +165,7 @@ discard block  | 
                                                    ||
| 165 | 165 | $this->isLumen = $app instanceof $lumenApplicationClass;  | 
                                                        
| 166 | 166 |          $this->supportsSessions = $app->bound('session'); | 
                                                        
| 167 | 167 | $this->horizonAvailable = static::$ignoreHorizonRequirements  | 
                                                        
| 168 | - || ! $this->isLumen && class_exists(Horizon::class);  | 
                                                        |
| 168 | + || !$this->isLumen && class_exists(Horizon::class);  | 
                                                        |
| 169 | 169 | }  | 
                                                        
| 170 | 170 | |
| 171 | 171 | /**  | 
                                                        
@@ -224,7 +224,7 @@ discard block  | 
                                                    ||
| 224 | 224 | }  | 
                                                        
| 225 | 225 | |
| 226 | 226 | $horizonConfig = $this->getSelectedHorizonConnectionConfiguration();  | 
                                                        
| 227 | - $options = Arr::get($horizonConfig, 'options', [ ]);  | 
                                                        |
| 227 | + $options = Arr::get($horizonConfig, 'options', []);  | 
                                                        |
| 228 | 228 |          $options['prefix'] = $this->config->get('horizon.prefix', 'horizon:'); | 
                                                        
| 229 | 229 | |
| 230 | 230 | $horizonConfig['options'] = $options;  | 
                                                        
@@ -399,7 +399,7 @@ discard block  | 
                                                    ||
| 399 | 399 | */  | 
                                                        
| 400 | 400 | protected function setSessionConfiguration()  | 
                                                        
| 401 | 401 |      { | 
                                                        
| 402 | - if (! $this->supportsSessions  | 
                                                        |
| 402 | + if (!$this->supportsSessions  | 
                                                        |
| 403 | 403 |              || $this->config->get('session.driver') !== 'redis-sentinel' | 
                                                        
| 404 | 404 |              || $this->config->get('session.connection') !== null | 
                                                        
| 405 | 405 |          ) { | 
                                                        
@@ -434,7 +434,7 @@ discard block  | 
                                                    ||
| 434 | 434 | protected function mergePackageConfiguration()  | 
                                                        
| 435 | 435 |      { | 
                                                        
| 436 | 436 | $defaultConfig = require self::CONFIG_PATH;  | 
                                                        
| 437 | -        $currentConfig = $this->config->get('redis-sentinel', [ ]); | 
                                                        |
| 437 | +        $currentConfig = $this->config->get('redis-sentinel', []); | 
                                                        |
| 438 | 438 | |
| 439 | 439 | $this->packageConfig = array_merge($defaultConfig, $currentConfig);  | 
                                                        
| 440 | 440 | }  | 
                                                        
@@ -449,7 +449,7 @@ discard block  | 
                                                    ||
| 449 | 449 |      { | 
                                                        
| 450 | 450 |          $connections = $this->config->get('database.redis-sentinel'); | 
                                                        
| 451 | 451 | |
| 452 | -        if (! is_array($connections)) { | 
                                                        |
| 452 | +        if (!is_array($connections)) { | 
                                                        |
| 453 | 453 | return;  | 
                                                        
| 454 | 454 | }  | 
                                                        
| 455 | 455 | |
@@ -124,7 +124,7 @@  | 
                                                    ||
| 124 | 124 | |
| 125 | 125 | // This package's Horizon service provider will set up the queue  | 
                                                        
| 126 | 126 | // connector a bit differently, so we don't need to do it twice:  | 
                                                        
| 127 | -        if (! $this->config->shouldIntegrateHorizon) { | 
                                                        |
| 127 | +        if (!$this->config->shouldIntegrateHorizon) { | 
                                                        |
| 128 | 128 | $this->addRedisSentinelQueueConnector();  | 
                                                        
| 129 | 129 | }  | 
                                                        
| 130 | 130 | |
@@ -62,7 +62,7 @@ discard block  | 
                                                    ||
| 62 | 62 | */  | 
                                                        
| 63 | 63 | public function boot()  | 
                                                        
| 64 | 64 |      { | 
                                                        
| 65 | -        if (! $this->config->shouldIntegrateHorizon) { | 
                                                        |
| 65 | +        if (!$this->config->shouldIntegrateHorizon) { | 
                                                        |
| 66 | 66 | return;  | 
                                                        
| 67 | 67 | }  | 
                                                        
| 68 | 68 | |
@@ -76,7 +76,7 @@ discard block  | 
                                                    ||
| 76 | 76 | */  | 
                                                        
| 77 | 77 | public function register()  | 
                                                        
| 78 | 78 |      { | 
                                                        
| 79 | -        if (! $this->config->shouldIntegrateHorizon) { | 
                                                        |
| 79 | +        if (!$this->config->shouldIntegrateHorizon) { | 
                                                        |
| 80 | 80 | return;  | 
                                                        
| 81 | 81 | }  | 
                                                        
| 82 | 82 | |
@@ -117,13 +117,13 @@ discard block  | 
                                                    ||
| 117 | 117 |      { | 
                                                        
| 118 | 118 | // If we're using this package for Horizon only, we only register this  | 
                                                        
| 119 | 119 | // service provider, so nothing overrides Laravel's standard Redis API:  | 
                                                        
| 120 | -        if (! $this->app->bound(RedisSentinelServiceProvider::class)) { | 
                                                        |
| 120 | +        if (!$this->app->bound(RedisSentinelServiceProvider::class)) { | 
                                                        |
| 121 | 121 | return true;  | 
                                                        
| 122 | 122 | }  | 
                                                        
| 123 | 123 | |
| 124 | 124 | // If we're already overriding Laravel's standard Redis API, we don't  | 
                                                        
| 125 | 125 | // need to rebind the "redis" service for Horizon.  | 
                                                        
| 126 | - return ! $this->config->shouldOverrideLaravelRedisApi;  | 
                                                        |
| 126 | + return !$this->config->shouldOverrideLaravelRedisApi;  | 
                                                        |
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
| 129 | 129 | /**  | 
                                                        
@@ -73,7 +73,7 @@  | 
                                                    ||
| 73 | 73 | public function makeInstance()  | 
                                                        
| 74 | 74 |      { | 
                                                        
| 75 | 75 | $class = $this->getVersionedRedisSentinelManagerClass();  | 
                                                        
| 76 | -        $config = $this->config->get('database.redis-sentinel', [ ]); | 
                                                        |
| 76 | +        $config = $this->config->get('database.redis-sentinel', []); | 
                                                        |
| 77 | 77 | $driver = Arr::pull($config, 'client', 'predis');  | 
                                                        
| 78 | 78 | |
| 79 | 79 | // Laravel 5.7 introduced the app as the first parameter:  | 
                                                        
@@ -57,7 +57,7 @@ discard block  | 
                                                    ||
| 57 | 57 | * @return PhpRedisConnection The Sentinel connection containing a configured  | 
                                                        
| 58 | 58 | * PhpRedis Client  | 
                                                        
| 59 | 59 | */  | 
                                                        
| 60 | - public function connect(array $servers, array $options = [ ])  | 
                                                        |
| 60 | + public function connect(array $servers, array $options = [])  | 
                                                        |
| 61 | 61 |      { | 
                                                        
| 62 | 62 | // Set the initial Sentinel servers.  | 
                                                        
| 63 | 63 |          $this->servers = array_map(function ($server) { | 
                                                        
@@ -66,7 +66,7 @@ discard block  | 
                                                    ||
| 66 | 66 | |
| 67 | 67 | // Merge the global options shared by all Sentinel connections with  | 
                                                        
| 68 | 68 | // connection-specific options  | 
                                                        
| 69 | - $clientOpts = array_merge($options, Arr::pull($servers, 'options', [ ]));  | 
                                                        |
| 69 | + $clientOpts = array_merge($options, Arr::pull($servers, 'options', []));  | 
                                                        |
| 70 | 70 | |
| 71 | 71 | // Extract the array of Sentinel connection options from the rest of  | 
                                                        
| 72 | 72 | // the client options  | 
                                                        
@@ -106,12 +106,12 @@ discard block  | 
                                                    ||
| 106 | 106 | shuffle($servers);  | 
                                                        
| 107 | 107 | |
| 108 | 108 | // Check if the redis extension is enabled.  | 
                                                        
| 109 | -        if (! extension_loaded('redis')) { | 
                                                        |
| 109 | +        if (!extension_loaded('redis')) { | 
                                                        |
| 110 | 110 |              throw new LogicException('Please make sure the PHP Redis extension is installed and enabled.'); | 
                                                        
| 111 | 111 | }  | 
                                                        
| 112 | 112 | |
| 113 | 113 | // Check if the extension is up to date and contains RedisSentinel.  | 
                                                        
| 114 | -        if (! class_exists(RedisSentinel::class)) { | 
                                                        |
| 114 | +        if (!class_exists(RedisSentinel::class)) { | 
                                                        |
| 115 | 115 |              throw new LogicException('Please make sure the PHP Redis extension is up to date.'); | 
                                                        
| 116 | 116 | }  | 
                                                        
| 117 | 117 | |
@@ -133,7 +133,7 @@ discard block  | 
                                                    ||
| 133 | 133 | |
| 134 | 134 | // Lookup the master node.  | 
                                                        
| 135 | 135 | $master = $sentinel->getMasterAddrByName($service);  | 
                                                        
| 136 | -                if (is_array($master) && ! count($master)) { | 
                                                        |
| 136 | +                if (is_array($master) && !count($master)) { | 
                                                        |
| 137 | 137 |                      throw new RedisException(sprintf('No master found for service "%s".', $service)); | 
                                                        
| 138 | 138 | }  | 
                                                        
| 139 | 139 | |
@@ -188,14 +188,14 @@ discard block  | 
                                                    ||
| 188 | 188 |      { | 
                                                        
| 189 | 189 |          if (is_string($server)) { | 
                                                        
| 190 | 190 |              list($host, $port) = explode(':', $server); | 
                                                        
| 191 | -            if (! $host || ! $port) { | 
                                                        |
| 191 | +            if (!$host || !$port) { | 
                                                        |
| 192 | 192 |                  throw new RedisException('Could not format the server definition.'); | 
                                                        
| 193 | 193 | }  | 
                                                        
| 194 | 194 | |
| 195 | 195 | return ['host' => $host, 'port' => (int) $port];  | 
                                                        
| 196 | 196 | }  | 
                                                        
| 197 | 197 | |
| 198 | -        if (! is_array($server)) { | 
                                                        |
| 198 | +        if (!is_array($server)) { | 
                                                        |
| 199 | 199 |              throw new RedisException('Could not format the server definition.'); | 
                                                        
| 200 | 200 | }  | 
                                                        
| 201 | 201 | |
@@ -67,7 +67,7 @@ discard block  | 
                                                    ||
| 67 | 67 | * Create a new Redis Sentinel connection from the provided configuration  | 
                                                        
| 68 | 68 | * options  | 
                                                        
| 69 | 69 | *  | 
                                                        
| 70 | - * @param array $server The client configuration for the connection  | 
                                                        |
| 70 | + * @param array $servers The client configuration for the connection  | 
                                                        |
| 71 | 71 | * @param array $options The global client options shared by all Sentinel  | 
                                                        
| 72 | 72 | * connections  | 
                                                        
| 73 | 73 | *  | 
                                                        
@@ -181,7 +181,7 @@ discard block  | 
                                                    ||
| 181 | 181 | * Retry the callback when a RedisException is catched.  | 
                                                        
| 182 | 182 | *  | 
                                                        
| 183 | 183 | * @param callable $callback The operation to execute.  | 
                                                        
| 184 | - * @return mixed The result of the first successful attempt.  | 
                                                        |
| 184 | + * @return null|callable The result of the first successful attempt.  | 
                                                        |
| 185 | 185 | *  | 
                                                        
| 186 | 186 | * @throws RedisRetryException After exhausting the allowed number of  | 
                                                        
| 187 | 187 | * attempts to connect.  |