@@ -195,7 +195,7 @@ class Credis_Client {
195195
196196 /**
197197 * Scheme of the Redis server (tcp, tls, tlsv1.2, unix)
198- * @var string
198+ * @var string|null
199199 */
200200 protected $ scheme ;
201201
@@ -207,19 +207,19 @@ class Credis_Client {
207207
208208 /**
209209 * Port on which the Redis server is running
210- * @var integer |null
210+ * @var int |null
211211 */
212212 protected $ port ;
213213
214214 /**
215215 * Timeout for connecting to Redis server
216- * @var float
216+ * @var float|null
217217 */
218218 protected $ timeout ;
219219
220220 /**
221221 * Timeout for reading response from Redis server
222- * @var float
222+ * @var float|null
223223 */
224224 protected $ readTimeout ;
225225
@@ -280,12 +280,12 @@ class Credis_Client {
280280 protected $ isWatching = FALSE ;
281281
282282 /**
283- * @var string
283+ * @var string|null
284284 */
285285 protected $ authUsername ;
286286
287287 /**
288- * @var string
288+ * @var string|null
289289 */
290290 protected $ authPassword ;
291291
@@ -301,7 +301,7 @@ class Credis_Client {
301301 protected $ wrapperMethods = array ('delete ' => 'del ' , 'getkeys ' => 'keys ' , 'sremove ' => 'srem ' );
302302
303303 /**
304- * @var array
304+ * @var array<string,string>|callable|null
305305 */
306306 protected $ renamedCommands ;
307307
@@ -342,18 +342,20 @@ public function getSslMeta()
342342 * $host may also be a path to a unix socket or a string in the form of tcp://[hostname]:[port] or unix://[path]
343343 *
344344 * @param string $host The hostname of the Redis server
345- * @param integer $port The port number of the Redis server
346- * @param float $timeout Timeout period in seconds
345+ * @param int|null $port The port number of the Redis server
346+ * @param float|null $timeout Timeout period in seconds
347347 * @param string $persistent Flag to establish persistent connection
348- * @param int $db The selected datbase of the Redis server
349- * @param string $password The authentication password of the Redis server
350- * @param string $username The authentication username of the Redis server
348+ * @param int $db The selected database of the Redis server
349+ * @param string|null $password The authentication password of the Redis server
350+ * @param string|null $username The authentication username of the Redis server
351351 * @param array|null $tlsOptions The TLS/SSL context options. See https://www.php.net/manual/en/context.ssl.php for details
352352 */
353353 public function __construct ($ host = '127.0.0.1 ' , $ port = 6379 , $ timeout = null , $ persistent = '' , $ db = 0 , $ password = null , $ username = null , array $ tlsOptions = null )
354354 {
355355 $ this ->host = (string ) $ host ;
356- $ this ->port = (int ) $ port ;
356+ if ($ port !== null ) {
357+ $ this ->port = (int ) $ port ;
358+ }
357359 $ this ->scheme = null ;
358360 $ this ->timeout = $ timeout ;
359361 $ this ->persistent = (string ) $ persistent ;
@@ -622,7 +624,7 @@ public function isConnected()
622624 * Set the read timeout for the connection. Use 0 to disable timeouts entirely (or use a very long timeout
623625 * if not supported).
624626 *
625- * @param int $timeout 0 (or -1) for no timeout, otherwise number of seconds
627+ * @param float $timeout 0 (or -1) for no timeout, otherwise number of seconds
626628 * @throws CredisException
627629 * @return Credis_Client
628630 */
0 commit comments