瀏覽代碼

Remove a few unnecessary strict comparisons.

Daniele Alessandri 12 年之前
父節點
當前提交
8cbcb09c4c

+ 4 - 4
lib/Predis/Client.php

@@ -62,7 +62,7 @@ class Client implements ClientInterface
      */
     protected function filterOptions($options)
     {
-        if ($options === null) {
+        if (!isset($options)) {
             return new ClientOptions();
         }
 
@@ -149,7 +149,7 @@ class Client implements ClientInterface
      */
     public function getClientFor($connectionID)
     {
-        if (($connection = $this->getConnectionById($connectionID)) === null) {
+        if (!$connection = $this->getConnectionById($connectionID)) {
             throw new \InvalidArgumentException("Invalid connection ID: '$connectionID'");
         }
 
@@ -280,14 +280,14 @@ class Client implements ClientInterface
 
             $response = $this->executeCommand($eval);
 
-            if (false === $response instanceof ResponseObjectInterface) {
+            if (!$response instanceof ResponseObjectInterface) {
                 $response = $command->parseResponse($response);
             }
 
             return $response;
         }
 
-        if ($this->options->exceptions === true) {
+        if ($this->options->exceptions) {
             throw new ServerException($response->getMessage());
         }
 

+ 1 - 1
lib/Predis/Cluster/Distribution/HashRing.php

@@ -122,7 +122,7 @@ class HashRing implements DistributionStrategyInterface, HashGeneratorInterface
             return;
         }
 
-        if (count($this->nodes) === 0) {
+        if (!$this->nodes) {
             throw new EmptyRingException('Cannot initialize empty hashring');
         }
 

+ 1 - 1
lib/Predis/Command/AbstractCommand.php

@@ -67,7 +67,7 @@ abstract class AbstractCommand implements CommandInterface
      */
     public function getArgument($index = 0)
     {
-        if (isset($this->arguments[$index]) === true) {
+        if (isset($this->arguments[$index])) {
             return $this->arguments[$index];
         }
     }

+ 3 - 3
lib/Predis/Connection/StreamConnection.php

@@ -81,10 +81,10 @@ class StreamConnection extends AbstractConnection
         $uri = "tcp://{$parameters->host}:{$parameters->port}/";
         $flags = STREAM_CLIENT_CONNECT;
 
-        if (isset($parameters->async_connect) && $parameters->async_connect === true) {
+        if (isset($parameters->async_connect) && $parameters->async_connect) {
             $flags |= STREAM_CLIENT_ASYNC_CONNECT;
         }
-        if (isset($parameters->persistent) && $parameters->persistent === true) {
+        if (isset($parameters->persistent) && $parameters->persistent) {
             $flags |= STREAM_CLIENT_PERSISTENT;
         }
 
@@ -121,7 +121,7 @@ class StreamConnection extends AbstractConnection
         $uri = "unix://{$parameters->path}";
         $flags = STREAM_CLIENT_CONNECT;
 
-        if ($parameters->persistent === true) {
+        if ($parameters->persistent) {
             $flags |= STREAM_CLIENT_PERSISTENT;
         }