Skip to content

Commit e5211ea

Browse files
committed
Removed predis from composer.json
Added check on phpredis or predis availability
1 parent 057aeda commit e5211ea

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pkg/redis/RedisConnectionFactory.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,17 @@ public function createContext(): Context
9494
private function createRedis(): Redis
9595
{
9696
if (false == $this->redis) {
97-
if (in_array('predis', $this->config['scheme_extensions'], true)) {
98-
$this->redis = new PRedis($this->config);
99-
} elseif (in_array('phpredis', $this->config['scheme_extensions'], true)) {
97+
if (in_array('phpredis', $this->config['scheme_extensions'], true)) {
98+
if (false == class_exists(\Redis::class)) {
99+
throw new \LogicException('You must install the redis extension to use phpredis');
100+
}
101+
100102
$this->redis = new PhpRedis($this->config);
101103
} else {
104+
if (false == class_exists(\Predis\Client::class)) {
105+
throw new \LogicException('The package Predis must be installed');
106+
}
107+
102108
$this->redis = new PRedis($this->config);
103109
}
104110

pkg/redis/composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"require": {
99
"php": "^7.1.3",
1010
"queue-interop/queue-interop": "0.7.x-dev",
11-
"enqueue/dsn": "0.9.x-dev",
12-
"predis/predis": "^1.1"
11+
"enqueue/dsn": "0.9.x-dev"
1312
},
1413
"require-dev": {
1514
"phpunit/phpunit": "~5.4.0",

0 commit comments

Comments
 (0)