diff --git a/Client.php b/Client.php index 4d84562..97c18f1 100755 --- a/Client.php +++ b/Client.php @@ -195,7 +195,7 @@ class Credis_Client { /** * Scheme of the Redis server (tcp, tls, tlsv1.2, unix) - * @var string + * @var string|null */ protected $scheme; @@ -207,19 +207,19 @@ class Credis_Client { /** * Port on which the Redis server is running - * @var integer|null + * @var int|null */ protected $port; /** * Timeout for connecting to Redis server - * @var float + * @var float|null */ protected $timeout; /** * Timeout for reading response from Redis server - * @var float + * @var float|null */ protected $readTimeout; @@ -280,12 +280,12 @@ class Credis_Client { protected $isWatching = FALSE; /** - * @var string + * @var string|null */ protected $authUsername; /** - * @var string + * @var string|null */ protected $authPassword; @@ -301,7 +301,7 @@ class Credis_Client { protected $wrapperMethods = array('delete' => 'del', 'getkeys' => 'keys', 'sremove' => 'srem'); /** - * @var array + * @var array|callable|null */ protected $renamedCommands; @@ -342,18 +342,20 @@ public function getSslMeta() * $host may also be a path to a unix socket or a string in the form of tcp://[hostname]:[port] or unix://[path] * * @param string $host The hostname of the Redis server - * @param integer $port The port number of the Redis server - * @param float $timeout Timeout period in seconds + * @param int|null $port The port number of the Redis server + * @param float|null $timeout Timeout period in seconds * @param string $persistent Flag to establish persistent connection - * @param int $db The selected datbase of the Redis server - * @param string $password The authentication password of the Redis server - * @param string $username The authentication username of the Redis server + * @param int $db The selected database of the Redis server + * @param string|null $password The authentication password of the Redis server + * @param string|null $username The authentication username of the Redis server * @param array|null $tlsOptions The TLS/SSL context options. See https://www.php.net/manual/en/context.ssl.php for details */ public function __construct($host = '127.0.0.1', $port = 6379, $timeout = null, $persistent = '', $db = 0, $password = null, $username = null, array $tlsOptions = null) { $this->host = (string) $host; - $this->port = (int) $port; + if ($port !== null) { + $this->port = (int) $port; + } $this->scheme = null; $this->timeout = $timeout; $this->persistent = (string) $persistent; @@ -622,7 +624,7 @@ public function isConnected() * Set the read timeout for the connection. Use 0 to disable timeouts entirely (or use a very long timeout * if not supported). * - * @param int $timeout 0 (or -1) for no timeout, otherwise number of seconds + * @param float $timeout 0 (or -1) for no timeout, otherwise number of seconds * @throws CredisException * @return Credis_Client */