@@ -54,7 +54,7 @@ class PredisConnection extends Component implements ConnectionInterface
5454 * @var array List of available redis commands.
5555 * @see https://redis.io/commands
5656 */
57- public array $ redisCommands = [
57+ public $ redisCommands = [
5858 'APPEND ' , // Append a value to a key
5959 'AUTH ' , // Authenticate to the server
6060 'BGREWRITEAOF ' , // Asynchronously rewrite the append-only file
@@ -289,17 +289,17 @@ protected function initConnection(): void
289289 /**
290290 * @var mixed Connection parameters for one or more servers.
291291 */
292- public mixed $ parameters ;
292+ public $ parameters ;
293293
294294 /**
295295 * @var mixed Options to configure some behaviours of the client.
296296 */
297- public mixed $ options = [];
297+ public $ options = [];
298298
299299 /**
300300 * @var Client|null redis connection
301301 */
302- protected Client | null $ client = null ;
302+ protected $ client ;
303303
304304 /**
305305 * Returns a value indicating whether the DB connection is established.
@@ -308,14 +308,17 @@ protected function initConnection(): void
308308 */
309309 public function getIsActive (): bool
310310 {
311- return (bool )$ this ->client ?->isConnected();
311+ if ($ this ->client === null ) {
312+ return false ;
313+ }
314+ return $ this ->client ->isConnected ();
312315 }
313316
314317 /**
315318 * @return mixed|ErrorInterface|ResponseInterface
316319 * @throws InvalidConfigException
317320 */
318- public function executeCommand ($ name , $ params = []): mixed
321+ public function executeCommand ($ name , $ params = [])
319322 {
320323 $ this ->open ();
321324
@@ -359,7 +362,10 @@ public function open(): void
359362 */
360363 public function close (): void
361364 {
362- $ this ->client ?->disconnect();
365+ if ($ this ->client === null ) {
366+ return ;
367+ }
368+ $ this ->client ->disconnect ();
363369 }
364370
365371 /**
@@ -386,7 +392,7 @@ public function getClient(): ?Client
386392 * @return mixed
387393 * @throws InvalidConfigException
388394 */
389- public function __call ($ name , $ params ): mixed
395+ public function __call ($ name , $ params )
390396 {
391397 $ redisCommand = strtoupper (Inflector::camel2words ($ name , false ));
392398 if (in_array ($ redisCommand , $ this ->redisCommands , true )) {
0 commit comments