mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix argument type
This commit is contained in:
parent
a3da9c538c
commit
e76e5dd02d
@ -16,35 +16,32 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||||||
|
|
||||||
class RedisConnectionFactory implements EventSubscriberInterface
|
class RedisConnectionFactory implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
protected $host;
|
private string $host;
|
||||||
|
|
||||||
protected $port;
|
private int $port;
|
||||||
|
|
||||||
/**
|
private ChillRedis $redis;
|
||||||
* @var Redis
|
|
||||||
*/
|
|
||||||
protected $redis;
|
|
||||||
|
|
||||||
protected $timeout;
|
private int $timeout;
|
||||||
|
|
||||||
public function __construct($parameters)
|
public function __construct($parameters)
|
||||||
{
|
{
|
||||||
$this->host = $parameters['host'];
|
$this->host = $parameters['host'];
|
||||||
$this->port = $parameters['port'];
|
$this->port = (int) $parameters['port'];
|
||||||
$this->timeout = $parameters['timeout'];
|
$this->timeout = (int) $parameters['timeout'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$redis = $this->redis = new ChillRedis();
|
$this->redis = new ChillRedis();
|
||||||
|
|
||||||
$result = $redis->connect($this->host, $this->port, $this->timeout);
|
$result = $this->redis->connect($this->host, $this->port, $this->timeout);
|
||||||
|
|
||||||
if (false === $result) {
|
if (false === $result) {
|
||||||
throw new RuntimeException('Could not connect to redis instance');
|
throw new RuntimeException('Could not connect to redis instance');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $redis;
|
return $this->redis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSubscribedEvents(): array
|
public static function getSubscribedEvents(): array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user