Эх сурвалжийг харах

Minor change (mostly micro-optimization).

Daniele Alessandri 13 жил өмнө
parent
commit
69d4c013f7

+ 3 - 1
lib/Predis/Cluster/PredisClusterHashStrategy.php

@@ -311,7 +311,9 @@ class PredisClusterHashStrategy implements CommandHashStrategyInterface
         $hash = $command->getHash();
         $hash = $command->getHash();
 
 
         if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
         if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
-            if ($key = call_user_func($this->commands[$cmdID], $command)) {
+            $key = call_user_func($this->commands[$cmdID], $command);
+
+            if (isset($key)) {
                 $hash = $this->getKeyHash($key);
                 $hash = $this->getKeyHash($key);
                 $command->setHash($hash);
                 $command->setHash($hash);
             }
             }

+ 3 - 1
lib/Predis/Cluster/RedisClusterHashStrategy.php

@@ -263,7 +263,9 @@ class RedisClusterHashStrategy implements CommandHashStrategyInterface
         $hash = $command->getHash();
         $hash = $command->getHash();
 
 
         if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
         if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
-            if (null !== $key = call_user_func($this->commands[$cmdID], $command)) {
+            $key = call_user_func($this->commands[$cmdID], $command);
+
+            if (isset($key)) {
                 $hash = $this->hashGenerator->hash($key);
                 $hash = $this->hashGenerator->hash($key);
                 $command->setHash($hash);
                 $command->setHash($hash);
             }
             }