From 5761acb848c08b55b680f22aafcbbe1412efa1eb Mon Sep 17 00:00:00 2001 From: clementtalleu Date: Sun, 22 Sep 2024 19:03:43 +0200 Subject: [PATCH] fix choice of redis client --- src/Om/Persister/AbstractPersister.php | 2 +- src/Om/RedisObjectManager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Om/Persister/AbstractPersister.php b/src/Om/Persister/AbstractPersister.php index e5c3a50..a412396 100644 --- a/src/Om/Persister/AbstractPersister.php +++ b/src/Om/Persister/AbstractPersister.php @@ -16,7 +16,7 @@ public function __construct( private ?KeyGenerator $keyGenerator = null, protected ?RedisClientInterface $redis = null ) { - $this->redis = $redis ?? getenv('REDIS_CLIENT') === 'predis' ? new PredisClient() : new RedisClient(); + $this->redis = $redis ?? (getenv('REDIS_CLIENT') === 'predis' ? new PredisClient() : new RedisClient()); $this->keyGenerator = $keyGenerator ?? new KeyGenerator(); } diff --git a/src/Om/RedisObjectManager.php b/src/Om/RedisObjectManager.php index c4e76a7..88b32db 100644 --- a/src/Om/RedisObjectManager.php +++ b/src/Om/RedisObjectManager.php @@ -31,7 +31,7 @@ final class RedisObjectManager implements RedisObjectManagerInterface public function __construct( private ?RedisClientInterface $redisClient = null, ) { - $this->redisClient = getenv('REDIS_CLIENT') === 'predis' ? new PredisClient() : new RedisClient(); + $this->redisClient = $redisClient ?? (getenv('REDIS_CLIENT') === 'predis' ? new PredisClient() : new RedisClient()); $this->keyGenerator = new KeyGenerator(); }