mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix: Typed property RedisConnectionFactory::$redis
must not be accessed before initialization.
This commit is contained in:
parent
e76e5dd02d
commit
6e521642a4
@ -14,7 +14,7 @@ namespace Chill\MainBundle\Redis;
|
|||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
class RedisConnectionFactory implements EventSubscriberInterface
|
final class RedisConnectionFactory implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
private string $host;
|
private string $host;
|
||||||
|
|
||||||
@ -29,12 +29,11 @@ class RedisConnectionFactory implements EventSubscriberInterface
|
|||||||
$this->host = $parameters['host'];
|
$this->host = $parameters['host'];
|
||||||
$this->port = (int) $parameters['port'];
|
$this->port = (int) $parameters['port'];
|
||||||
$this->timeout = (int) $parameters['timeout'];
|
$this->timeout = (int) $parameters['timeout'];
|
||||||
|
$this->redis = new ChillRedis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$this->redis = new ChillRedis();
|
|
||||||
|
|
||||||
$result = $this->redis->connect($this->host, $this->port, $this->timeout);
|
$result = $this->redis->connect($this->host, $this->port, $this->timeout);
|
||||||
|
|
||||||
if (false === $result) {
|
if (false === $result) {
|
||||||
@ -55,8 +54,6 @@ class RedisConnectionFactory implements EventSubscriberInterface
|
|||||||
|
|
||||||
public function onKernelFinishRequest()
|
public function onKernelFinishRequest()
|
||||||
{
|
{
|
||||||
if (null !== $this->redis) {
|
$this->redis->close();
|
||||||
$this->redis->close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user