浏览代码

Remove useless default NULL value in method arguments.

Daniele Alessandri 12 年之前
父节点
当前提交
be46ab813c
共有 2 个文件被更改,包括 4 次插入10 次删除
  1. 2 4
      lib/Predis/Connection/PredisCluster.php
  2. 2 6
      lib/Predis/Connection/RedisCluster.php

+ 2 - 4
lib/Predis/Connection/PredisCluster.php

@@ -143,11 +143,9 @@ class PredisCluster implements ClusterConnectionInterface, \IteratorAggregate, \
     /**
      * {@inheritdoc}
      */
-    public function getConnectionById($id = null)
+    public function getConnectionById($connectionId)
     {
-        $alias = $id ?: 0;
-
-        return isset($this->pool[$alias]) ? $this->pool[$alias] : null;
+        return isset($this->pool[$connectionId]) ? $this->pool[$connectionId] : null;
     }
 
     /**

+ 2 - 6
lib/Predis/Connection/RedisCluster.php

@@ -228,13 +228,9 @@ class RedisCluster implements ClusterConnectionInterface, \IteratorAggregate, \C
     /**
      * {@inheritdoc}
      */
-    public function getConnectionById($id = null)
+    public function getConnectionById($connectionId)
     {
-        if (!isset($id)) {
-            throw new \InvalidArgumentException("A valid connection ID must be specified");
-        }
-
-        return isset($this->pool[$id]) ? $this->pool[$id] : null;
+        return isset($this->pool[$connectionId]) ? $this->pool[$connectionId] : null;
     }
 
     /**