Merge "Type hint against LinkTarget in WatchedItemStore"
[lhc/web/wiklou.git] / includes / libs / redis / RedisConnectionPool.php
index 9a8086f..eb645cc 100644 (file)
@@ -23,6 +23,7 @@
 
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
 
 /**
  * Helper class to manage Redis connections.
@@ -81,7 +82,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
                                __CLASS__ . ' requires a Redis client library. ' .
                                'See https://www.mediawiki.org/wiki/Redis#Setup' );
                }
-               $this->logger = $options['logger'] ?? new \Psr\Log\NullLogger();
+               $this->logger = $options['logger'] ?? new NullLogger();
                $this->connectTimeout = $options['connectTimeout'];
                $this->readTimeout = $options['readTimeout'];
                $this->persistent = $options['persistent'];
@@ -98,10 +99,6 @@ class RedisConnectionPool implements LoggerAwareInterface {
                $this->id = $id;
        }
 
-       /**
-        * @param LoggerInterface $logger
-        * @return null
-        */
        public function setLogger( LoggerInterface $logger ) {
                $this->logger = $logger;
        }
@@ -169,10 +166,13 @@ class RedisConnectionPool implements LoggerAwareInterface {
         * @param string $server A hostname/port combination or the absolute path of a UNIX socket.
         *                       If a hostname is specified but no port, port 6379 will be used.
         * @param LoggerInterface|null $logger PSR-3 logger intance. [optional]
-        * @return RedisConnRef|bool Returns false on failure
+        * @return RedisConnRef|Redis|bool Returns false on failure
         * @throws MWException
         */
        public function getConnection( $server, LoggerInterface $logger = null ) {
+               // The above @return also documents 'Redis' for convenience with IDEs.
+               // RedisConnRef uses PHP magic methods, which wouldn't be recognised.
+
                $logger = $logger ?: $this->logger;
                // Check the listing "dead" servers which have had a connection errors.
                // Servers are marked dead for a limited period of time, to