1 | <?php |
||
23 | class PhpRedisConnector extends LaravelPhpRedisConnector |
||
24 | { |
||
25 | /** |
||
26 | * Holds the current sentinel servers. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $servers; |
||
31 | |||
32 | /** |
||
33 | * The number of times the client attempts to retry a command when it fails |
||
34 | * to connect to a Redis instance behind Sentinel. |
||
35 | * |
||
36 | * @var int |
||
37 | */ |
||
38 | protected $retryLimit = 20; |
||
39 | |||
40 | /** |
||
41 | * The time in milliseconds to wait before the client retries a failed |
||
42 | * command. |
||
43 | * |
||
44 | * @var int |
||
45 | */ |
||
46 | protected $retryWait = 1000; |
||
47 | |||
48 | /** |
||
49 | * Configuration options specific to Sentinel connection operation |
||
50 | * |
||
51 | * Some of the Sentinel configuration options can be entered in this class. |
||
52 | * The retry_wait and retry_limit values are passed to the connection. |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | protected $sentinelKeys = [ |
||
57 | 'sentinel_timeout' => null, |
||
58 | 'retry_wait' => null, |
||
59 | 'retry_limit' => null, |
||
60 | 'update_sentinels' => null, |
||
61 | |||
62 | 'sentinel_persistent' => null, |
||
63 | 'sentinel_read_timeout' => null, |
||
64 | ]; |
||
65 | |||
66 | /** |
||
67 | * Create a new Redis Sentinel connection from the provided configuration |
||
68 | * options |
||
69 | * |
||
70 | * @param array $server The client configuration for the connection |
||
|
|||
71 | * @param array $options The global client options shared by all Sentinel |
||
72 | * connections |
||
73 | * |
||
74 | * @return PhpRedisConnection The Sentinel connection containing a configured |
||
75 | * PhpRedis Client |
||
76 | */ |
||
77 | public function connect(array $servers, array $options = [ ]) |
||
112 | |||
113 | /** |
||
114 | * Create the Redis client instance |
||
115 | * |
||
116 | * @param array $options |
||
117 | * @return Redis |
||
118 | * |
||
119 | * @throws LogicException |
||
120 | */ |
||
121 | protected function createClientWithSentinel(array $options) |
||
179 | |||
180 | /** |
||
181 | * Retry the callback when a RedisException is catched. |
||
182 | * |
||
183 | * @param callable $callback The operation to execute. |
||
184 | * @return mixed The result of the first successful attempt. |
||
185 | * |
||
186 | * @throws RedisRetryException After exhausting the allowed number of |
||
187 | * attempts to connect. |
||
188 | */ |
||
189 | protected function retryOnFailure(callable $callback) |
||
208 | |||
209 | /** |
||
210 | * Update the list With sentinel servers. |
||
211 | * |
||
212 | * @param RedisSentinel $sentinel |
||
213 | * @param string $currentHost |
||
214 | * @param int $currentPort |
||
215 | * @param string $service |
||
216 | * @return void |
||
217 | */ |
||
218 | protected function updateSentinels(RedisSentinel $sentinel, string $currentHost, int $currentPort, string $service) |
||
234 | |||
235 | /** |
||
236 | * Format a server. |
||
237 | * |
||
238 | * @param mixed $server |
||
239 | * @return array |
||
240 | * |
||
241 | * @throws RedisException |
||
242 | */ |
||
243 | protected function formatServer($server) |
||
260 | } |
||
261 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.