Browse Source

Fix and reword some exception messages.

Daniele Alessandri 11 năm trước cách đây
mục cha
commit
0f34f41ccf
70 tập tin đã thay đổi với 172 bổ sung180 xóa
  1. 5 5
      lib/Predis/Client.php
  2. 1 1
      lib/Predis/Cluster/Distributor/HashRing.php
  3. 1 1
      lib/Predis/Cluster/PredisStrategy.php
  4. 1 1
      lib/Predis/Cluster/RedisStrategy.php
  5. 1 3
      lib/Predis/Collection/Iterator/CursorBasedIterator.php
  6. 2 6
      lib/Predis/Collection/Iterator/ListKey.php
  7. 2 2
      lib/Predis/Command/Processor/ProcessorChain.php
  8. 3 1
      lib/Predis/Command/RawCommand.php
  9. 3 1
      lib/Predis/Configuration/ClusterOption.php
  10. 3 1
      lib/Predis/Configuration/ConnectionFactoryOption.php
  11. 1 1
      lib/Predis/Configuration/ProfileOption.php
  12. 1 1
      lib/Predis/Configuration/ReplicationOption.php
  13. 3 3
      lib/Predis/Connection/AbstractConnection.php
  14. 3 3
      lib/Predis/Connection/ComposableStreamConnection.php
  15. 4 4
      lib/Predis/Connection/Factory.php
  16. 2 4
      lib/Predis/Connection/MasterSlaveReplication.php
  17. 7 7
      lib/Predis/Connection/PhpiredisSocketConnection.php
  18. 2 2
      lib/Predis/Connection/PhpiredisStreamConnection.php
  19. 1 1
      lib/Predis/Connection/PredisCluster.php
  20. 2 2
      lib/Predis/Connection/RedisCluster.php
  21. 4 4
      lib/Predis/Connection/StreamConnection.php
  22. 5 5
      lib/Predis/Connection/WebdisConnection.php
  23. 2 4
      lib/Predis/Monitor/Consumer.php
  24. 7 6
      lib/Predis/Pipeline/Atomic.php
  25. 3 1
      lib/Predis/Pipeline/ConnectionErrorProof.php
  26. 2 2
      lib/Predis/Pipeline/Pipeline.php
  27. 6 8
      lib/Predis/Profile/Factory.php
  28. 5 5
      lib/Predis/Profile/RedisProfile.php
  29. 1 1
      lib/Predis/Protocol/Text/Handler/BulkResponse.php
  30. 1 1
      lib/Predis/Protocol/Text/Handler/IntegerResponse.php
  31. 1 1
      lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php
  32. 1 1
      lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php
  33. 1 1
      lib/Predis/Protocol/Text/ProtocolProcessor.php
  34. 2 2
      lib/Predis/Protocol/Text/ResponseReader.php
  35. 3 3
      lib/Predis/PubSub/Consumer.php
  36. 1 1
      lib/Predis/PubSub/DispatcherLoop.php
  37. 1 1
      lib/Predis/Replication/ReplicationStrategy.php
  38. 2 4
      lib/Predis/Response/Iterator/MultiBulkTuple.php
  39. 13 13
      lib/Predis/Transaction/MultiExec.php
  40. 1 1
      tests/PHPUnit/PredisConnectionTestCase.php
  41. 2 2
      tests/PHPUnit/PredisProfileTestCase.php
  42. 4 4
      tests/Predis/ClientTest.php
  43. 2 4
      tests/Predis/Cluster/Distributor/EmptyRingExceptionTest.php
  44. 1 1
      tests/Predis/Collection/Iterator/HashKeyTest.php
  45. 1 1
      tests/Predis/Collection/Iterator/KeyspaceTest.php
  46. 1 1
      tests/Predis/Collection/Iterator/SetKeyTest.php
  47. 1 1
      tests/Predis/Collection/Iterator/SortedSetKeyTest.php
  48. 1 1
      tests/Predis/Command/RawCommandTest.php
  49. 2 2
      tests/Predis/Connection/ComposableStreamConnectionTest.php
  50. 8 9
      tests/Predis/Connection/FactoryTest.php
  51. 5 5
      tests/Predis/Connection/MasterSlaveReplicationTest.php
  52. 1 1
      tests/Predis/Connection/PhpiredisSocketConnectionTest.php
  53. 1 1
      tests/Predis/Connection/PhpiredisStreamConnectionTest.php
  54. 1 1
      tests/Predis/Connection/PredisClusterTest.php
  55. 1 1
      tests/Predis/Connection/RedisClusterTest.php
  56. 2 2
      tests/Predis/Connection/StreamConnectionTest.php
  57. 5 5
      tests/Predis/Connection/WebdisConnectionTest.php
  58. 2 2
      tests/Predis/Monitor/ConsumerTest.php
  59. 2 2
      tests/Predis/Pipeline/AtomicTest.php
  60. 2 2
      tests/Predis/Profile/FactoryTest.php
  61. 1 1
      tests/Predis/Protocol/Text/Handler/BulkResponseTest.php
  62. 1 1
      tests/Predis/Protocol/Text/Handler/IntegerResponseTest.php
  63. 1 1
      tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php
  64. 1 1
      tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponseTest.php
  65. 1 1
      tests/Predis/Protocol/Text/ProtocolProcessorTest.php
  66. 2 2
      tests/Predis/Protocol/Text/ResponseReaderTest.php
  67. 2 2
      tests/Predis/PubSub/ConsumerTest.php
  68. 1 1
      tests/Predis/Replication/ReplicationStrategyTest.php
  69. 2 2
      tests/Predis/Response/Iterator/MultiBulkTupleTest.php
  70. 5 5
      tests/Predis/Transaction/MultiExecTest.php

+ 5 - 5
lib/Predis/Client.php

@@ -75,7 +75,7 @@ class Client implements ClientInterface
             return $options;
         }
 
-        throw new InvalidArgumentException("Invalid type for client options");
+        throw new InvalidArgumentException("Invalid type for client options.");
     }
 
     /**
@@ -134,7 +134,7 @@ class Client implements ClientInterface
             return $connection;
         }
 
-        throw new InvalidArgumentException('Invalid type for connection parameters');
+        throw new InvalidArgumentException('Invalid type for connection parameters.');
     }
 
     /**
@@ -151,7 +151,7 @@ class Client implements ClientInterface
 
             if (!$connection instanceof ConnectionInterface) {
                 throw new UnexpectedValueException(
-                    'The callable connection initializer returned an invalid type'
+                    'The callable connection initializer returned an invalid type.'
                 );
             }
 
@@ -185,7 +185,7 @@ class Client implements ClientInterface
     public function getClientFor($connectionID)
     {
         if (!$connection = $this->getConnectionById($connectionID)) {
-            throw new InvalidArgumentException("Invalid connection ID: $connectionID");
+            throw new InvalidArgumentException("Invalid connection ID: $connectionID.");
         }
 
         return new static($connection, $this->options);
@@ -247,7 +247,7 @@ class Client implements ClientInterface
     {
         if (!$this->connection instanceof AggregateConnectionInterface) {
             throw new NotSupportedException(
-                'Retrieving connections by ID is supported only when using aggregate connections'
+                'Retrieving connections by ID is supported only by aggregate connections.'
             );
         }
 

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

@@ -128,7 +128,7 @@ class HashRing implements DistributorInterface, HashGeneratorInterface
         }
 
         if (!$this->nodes) {
-            throw new EmptyRingException('Cannot initialize empty hashring');
+            throw new EmptyRingException('Cannot initialize an empty hashring.');
         }
 
         $this->ring = array();

+ 1 - 1
lib/Predis/Cluster/PredisStrategy.php

@@ -193,7 +193,7 @@ class PredisStrategy implements StrategyInterface
 
         if (!is_callable($callback)) {
             throw new \InvalidArgumentException(
-                "Callback must be a valid callable object or NULL"
+                "The argument must be a callable object or NULL."
             );
         }
 

+ 1 - 1
lib/Predis/Cluster/RedisStrategy.php

@@ -178,7 +178,7 @@ class RedisStrategy implements StrategyInterface
 
         if (!is_callable($callback)) {
             throw new \InvalidArgumentException(
-                "Callback must be a valid callable object or NULL"
+                "The argument must be a callable object or NULL."
             );
         }
 

+ 1 - 3
lib/Predis/Collection/Iterator/CursorBasedIterator.php

@@ -65,9 +65,7 @@ abstract class CursorBasedIterator implements Iterator
     protected function requiredCommand(ClientInterface $client, $commandID)
     {
         if (!$client->getProfile()->supportsCommand($commandID)) {
-            throw new NotSupportedException(
-                "The specified server profile does not support the `$commandID` command."
-            );
+            throw new NotSupportedException("The current profile does not support '$commandID'.");
         }
     }
 

+ 2 - 6
lib/Predis/Collection/Iterator/ListKey.php

@@ -51,9 +51,7 @@ class ListKey implements Iterator
         $this->requiredCommand($client, 'LRANGE');
 
         if ((false === $count = filter_var($count, FILTER_VALIDATE_INT)) || $count < 0) {
-            throw new InvalidArgumentException(
-                'The $count argument must be a positive integer.'
-            );
+            throw new InvalidArgumentException('The $count argument must be a positive integer.');
         }
 
         $this->client = $client;
@@ -73,9 +71,7 @@ class ListKey implements Iterator
     protected function requiredCommand(ClientInterface $client, $commandID)
     {
         if (!$client->getProfile()->supportsCommand($commandID)) {
-            throw new NotSupportedException(
-                "The specified server profile does not support the `$commandID` command."
-            );
+            throw new NotSupportedException("The current profile does not support '$commandID'.");
         }
     }
 

+ 2 - 2
lib/Predis/Command/Processor/ProcessorChain.php

@@ -111,8 +111,8 @@ class ProcessorChain implements CommandProcessorChainInterface, \ArrayAccess
     {
         if (!$processor instanceof CommandProcessorInterface) {
             throw new \InvalidArgumentException(
-                'A processor chain can hold only instances of classes implementing '.
-                'the Predis\Command\Processor\CommandProcessorInterface interface'
+                "A processor chain accepts only instances of ".
+                "'Predis\Command\Processor\CommandProcessorInterface'."
             );
         }
 

+ 3 - 1
lib/Predis/Command/RawCommand.php

@@ -32,7 +32,9 @@ class RawCommand implements CommandInterface
     public function __construct(array $arguments)
     {
         if (!$arguments) {
-            throw new InvalidArgumentException("Arguments array is missing the command ID");
+            throw new InvalidArgumentException(
+                'The arguments array must contain at least the command ID.'
+            );
         }
 
         $this->commandID = strtoupper(array_shift($arguments));

+ 3 - 1
lib/Predis/Configuration/ClusterOption.php

@@ -56,7 +56,9 @@ class ClusterOption implements OptionInterface
         }
 
         if (!$value instanceof ClusterConnectionInterface) {
-            throw new InvalidArgumentException('Instance of Predis\Connection\ClusterConnectionInterface expected');
+            throw new InvalidArgumentException(
+                "An instance of type 'Predis\Connection\ClusterConnectionInterface' was expected."
+            );
         }
 
         return $value;

+ 3 - 1
lib/Predis/Configuration/ConnectionFactoryOption.php

@@ -39,7 +39,9 @@ class ConnectionFactoryOption implements OptionInterface
 
             return $factory;
         } else {
-            throw new InvalidArgumentException('Invalid value for the connections option');
+            throw new InvalidArgumentException(
+                'Invalid value provided for the connections option.'
+            );
         }
     }
 

+ 1 - 1
lib/Predis/Configuration/ProfileOption.php

@@ -46,7 +46,7 @@ class ProfileOption implements OptionInterface
             $value = Factory::get($value);
             $this->setProcessors($options, $value);
         } else if (!$value instanceof ProfileInterface) {
-            throw new InvalidArgumentException('Invalid value for the profile option');
+            throw new InvalidArgumentException('Invalid value for the profile option.');
         }
 
         return $value;

+ 1 - 1
lib/Predis/Configuration/ReplicationOption.php

@@ -48,7 +48,7 @@ class ReplicationOption implements OptionInterface
         }
 
         throw new InvalidArgumentException(
-            'Instance of Predis\Connection\ReplicationConnectionInterface expected'
+            "An instance of type 'Predis\Connection\ReplicationConnectionInterface' was expected."
         );
     }
 

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

@@ -59,11 +59,11 @@ abstract class AbstractConnection implements SingleConnectionInterface
         $scheme = $parameters->scheme;
 
         if ($scheme !== 'tcp' && $scheme !== 'unix') {
-            throw new InvalidArgumentException("Invalid scheme: $scheme");
+            throw new InvalidArgumentException("Invalid scheme: '$scheme'.");
         }
 
         if ($scheme === 'unix' && !isset($parameters->path)) {
-            throw new InvalidArgumentException('Missing UNIX domain socket path');
+            throw new InvalidArgumentException('Missing UNIX domain socket path.');
         }
 
         return $parameters;
@@ -90,7 +90,7 @@ abstract class AbstractConnection implements SingleConnectionInterface
     public function connect()
     {
         if ($this->isConnected()) {
-            throw new ClientException('Connection already estabilished');
+            throw new ClientException('Connection already estabilished.');
         }
 
         $this->resource = $this->createResource();

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

@@ -59,7 +59,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC
     public function readBuffer($length)
     {
         if ($length <= 0) {
-            throw new \InvalidArgumentException('Length parameter must be greater than 0');
+            throw new \InvalidArgumentException('Length parameter must be greater than 0.');
         }
 
         $value = '';
@@ -69,7 +69,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC
             $chunk = fread($socket, $length);
 
             if ($chunk === false || $chunk === '') {
-                $this->onConnectionError('Error while reading bytes from the server');
+                $this->onConnectionError('Error while reading bytes from the server.');
             }
 
             $value .= $chunk;
@@ -90,7 +90,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC
             $chunk = fgets($socket);
 
             if ($chunk === false || $chunk === '') {
-                $this->onConnectionError('Error while reading line from the server');
+                $this->onConnectionError('Error while reading line from the server.');
             }
 
             $value .= $chunk;

+ 4 - 4
lib/Predis/Connection/Factory.php

@@ -46,7 +46,7 @@ class Factory implements FactoryInterface
 
         if (!$class->isSubclassOf('Predis\Connection\SingleConnectionInterface')) {
             throw new InvalidArgumentException(
-                'A connection initializer must be a valid connection class or a callable object'
+                'A connection initializer must be a valid connection class or a callable object.'
             );
         }
 
@@ -81,7 +81,7 @@ class Factory implements FactoryInterface
         $scheme = $parameters->scheme;
 
         if (!isset($this->schemes[$scheme])) {
-            throw new InvalidArgumentException("Unknown connection scheme: $scheme");
+            throw new InvalidArgumentException("Unknown connection scheme: '$scheme'.");
         }
 
         $initializer = $this->schemes[$scheme];
@@ -95,8 +95,8 @@ class Factory implements FactoryInterface
 
         if (!$connection instanceof SingleConnectionInterface) {
             throw new InvalidArgumentException(
-                'Objects returned by connection initializers must implement ' .
-                'Predis\Connection\SingleConnectionInterface'
+                "Objects returned by connection initializers must implement ".
+                "'Predis\Connection\SingleConnectionInterface'."
             );
         }
 

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

@@ -44,9 +44,7 @@ class MasterSlaveReplication implements ReplicationConnectionInterface
     protected function check()
     {
         if (!isset($this->master) || !$this->slaves) {
-            throw new RuntimeException(
-                'Replication needs a master and at least one slave.'
-            );
+            throw new RuntimeException('Replication needs one master and at least one slave.');
         }
     }
 
@@ -148,7 +146,7 @@ class MasterSlaveReplication implements ReplicationConnectionInterface
             $connection = $this->getConnectionById($connection);
         }
         if ($connection !== $this->master && !in_array($connection, $this->slaves, true)) {
-            throw new InvalidArgumentException('The specified connection is not valid.');
+            throw new InvalidArgumentException('Invalid connection or connection not found.');
         }
 
         $this->current = $connection;

+ 7 - 7
lib/Predis/Connection/PhpiredisSocketConnection.php

@@ -76,13 +76,13 @@ class PhpiredisSocketConnection extends AbstractConnection
     {
         if (!extension_loaded('sockets')) {
             throw new NotSupportedException(
-                'The "sockets" extension is required by this connection backend'
+                'The "sockets" extension is required by this connection backend.'
             );
         }
 
         if (!extension_loaded('phpiredis')) {
             throw new NotSupportedException(
-                'The "phpiredis" extension is required by this connection backend'
+                'The "phpiredis" extension is required by this connection backend.'
             );
         }
     }
@@ -94,7 +94,7 @@ class PhpiredisSocketConnection extends AbstractConnection
     {
         if (isset($parameters->persistent)) {
             throw new NotSupportedException(
-                "Persistent connections are not supported by this connection backend"
+                "Persistent connections are not supported by this connection backend."
             );
         }
 
@@ -239,7 +239,7 @@ class PhpiredisSocketConnection extends AbstractConnection
 
         if (ip2long($host) === false) {
             if (($addresses = gethostbynamel($host)) === false) {
-                $this->onConnectionError("Cannot resolve the address of $host");
+                $this->onConnectionError("Cannot resolve the address of '$host'.");
             }
 
             return $addresses[array_rand($addresses)];
@@ -281,10 +281,10 @@ class PhpiredisSocketConnection extends AbstractConnection
         $selected = socket_select($selectable, $selectable, $null, $timeoutSecs, $timeoutUSecs);
 
         if ($selected === 2) {
-            $this->onConnectionError('Connection refused', SOCKET_ECONNREFUSED);
+            $this->onConnectionError('Connection refused.', SOCKET_ECONNREFUSED);
         }
         if ($selected === 0) {
-            $this->onConnectionError('Connection timed out', SOCKET_ETIMEDOUT);
+            $this->onConnectionError('Connection timed out.', SOCKET_ETIMEDOUT);
         }
         if ($selected === false) {
             $this->emitSocketError();
@@ -333,7 +333,7 @@ class PhpiredisSocketConnection extends AbstractConnection
             }
 
             if ($written === false) {
-                $this->onConnectionError('Error while writing bytes to the server');
+                $this->onConnectionError('Error while writing bytes to the server.');
             }
 
             $buffer = substr($buffer, $written);

+ 2 - 2
lib/Predis/Connection/PhpiredisStreamConnection.php

@@ -78,7 +78,7 @@ class PhpiredisStreamConnection extends StreamConnection
     {
         if (!extension_loaded('phpiredis')) {
             throw new NotSupportedException(
-                'The "phpiredis" extension is required by this connection backend'
+                'The "phpiredis" extension is required by this connection backend.'
             );
         }
     }
@@ -144,7 +144,7 @@ class PhpiredisStreamConnection extends StreamConnection
             $buffer = fread($socket, 4096);
 
             if ($buffer === false || $buffer === '') {
-                $this->onConnectionError('Error while reading bytes from the server');
+                $this->onConnectionError('Error while reading bytes from the server.');
 
                 return;
             }

+ 1 - 1
lib/Predis/Connection/PredisCluster.php

@@ -135,7 +135,7 @@ class PredisCluster implements ClusterConnectionInterface, IteratorAggregate, Co
 
         if (!isset($hash)) {
             throw new NotSupportedException(
-                "Cannot use {$command->getId()} with a cluster of connections"
+                "Cannot use '{$command->getId()}' over clusters of connections."
             );
         }
 

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

@@ -266,7 +266,7 @@ class RedisCluster implements ClusterConnectionInterface, IteratorAggregate, Cou
 
         if (!isset($hash)) {
             throw new NotSupportedException(
-                "Cannot use {$command->getId()} with redis-cluster"
+                "Cannot use '{$command->getId()}' with redis-cluster."
             );
         }
 
@@ -410,7 +410,7 @@ class RedisCluster implements ClusterConnectionInterface, IteratorAggregate, Cou
 
             default:
                 throw new ProtocolException(
-                    "Unexpected request type for a move request: $request"
+                    "Unexpected request type for a move request: $request."
                 );
         }
     }

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

@@ -167,7 +167,7 @@ class StreamConnection extends AbstractConnection
             }
 
             if ($written === false || $written === 0) {
-                $this->onConnectionError('Error while writing bytes to the server');
+                $this->onConnectionError('Error while writing bytes to the server.');
             }
 
             $buffer = substr($buffer, $written);
@@ -183,7 +183,7 @@ class StreamConnection extends AbstractConnection
         $chunk = fgets($socket);
 
         if ($chunk === false || $chunk === '') {
-            $this->onConnectionError('Error while reading line from the server');
+            $this->onConnectionError('Error while reading line from the server.');
         }
 
         $prefix = $chunk[0];
@@ -207,7 +207,7 @@ class StreamConnection extends AbstractConnection
                     $chunk = fread($socket, min($bytesLeft, 4096));
 
                     if ($chunk === false || $chunk === '') {
-                        $this->onConnectionError('Error while reading bytes from the server');
+                        $this->onConnectionError('Error while reading bytes from the server.');
                     }
 
                     $bulkData .= $chunk;
@@ -238,7 +238,7 @@ class StreamConnection extends AbstractConnection
                 return new ErrorResponse($payload);
 
             default:
-                $this->onProtocolError("Unknown prefix: '$prefix'");
+                $this->onProtocolError("Unknown response prefix: '$prefix'.");
         }
     }
 

+ 5 - 5
lib/Predis/Connection/WebdisConnection.php

@@ -58,7 +58,7 @@ class WebdisConnection implements SingleConnectionInterface
         $this->assertExtensions();
 
         if ($parameters->scheme !== 'http') {
-            throw new InvalidArgumentException("Invalid scheme: {$parameters->scheme}");
+            throw new InvalidArgumentException("Invalid scheme: '{$parameters->scheme}'.");
         }
 
         $this->parameters = $parameters;
@@ -82,7 +82,7 @@ class WebdisConnection implements SingleConnectionInterface
     private function throwNotSupportedException($function)
     {
         $class = __CLASS__;
-        throw new NotSupportedException("The method $class::$function() is not supported");
+        throw new NotSupportedException("The method $class::$function() is not supported.");
     }
 
     /**
@@ -92,13 +92,13 @@ class WebdisConnection implements SingleConnectionInterface
     {
         if (!extension_loaded('curl')) {
             throw new NotSupportedException(
-                'The "curl" extension is required by this connection backend'
+                'The "curl" extension is required by this connection backend.'
             );
         }
 
         if (!extension_loaded('phpiredis')) {
             throw new NotSupportedException(
-                'The "phpiredis" extension is required by this connection backend'
+                'The "phpiredis" extension is required by this connection backend.'
             );
         }
     }
@@ -224,7 +224,7 @@ class WebdisConnection implements SingleConnectionInterface
             case 'UNWATCH':
             case 'DISCARD':
             case 'MONITOR':
-                throw new NotSupportedException("Disabled command: $commandID");
+                throw new NotSupportedException("Command '$commandID' is not allowed by Webdis.");
 
             default:
                 return $commandID;

+ 2 - 4
lib/Predis/Monitor/Consumer.php

@@ -56,14 +56,12 @@ class Consumer implements Iterator
     {
         if ($client->getConnection() instanceof AggregateConnectionInterface) {
             throw new NotSupportedException(
-                'Cannot initialize a monitor consumer when using aggregate connections'
+                'Cannot initialize a monitor consumer over aggregate connections.'
             );
         }
 
         if ($client->getProfile()->supportsCommand('monitor') === false) {
-            throw new NotSupportedException(
-                'The current profile does not support the MONITOR command'
-            );
+            throw new NotSupportedException("The current profile does not support 'MONITOR'.");
         }
     }
 

+ 7 - 6
lib/Predis/Pipeline/Atomic.php

@@ -34,7 +34,7 @@ class Atomic extends Pipeline
     {
         if (!$client->getProfile()->supportsCommands(array('multi', 'exec', 'discard'))) {
             throw new ClientException(
-                'The specified server profile must support MULTI, EXEC and DISCARD.'
+                "The current profile does not support 'MULTI', 'EXEC' and 'DISCARD'."
             );
         }
 
@@ -51,9 +51,7 @@ class Atomic extends Pipeline
         if (!$connection instanceof SingleConnectionInterface) {
             $class = __CLASS__;
 
-            throw new ClientException(
-                "$class can be used only with connections to single nodes"
-            );
+            throw new ClientException("The class '$class' does not support aggregate connections.");
         }
 
         return $connection;
@@ -85,13 +83,16 @@ class Atomic extends Pipeline
         if (!isset($executed)) {
             // TODO: should be throwing a more appropriate exception.
             throw new ClientException(
-                'The underlying transaction has been aborted by the server'
+                'The underlying transaction has been aborted by the server.'
             );
         }
 
         if (count($executed) !== count($commands)) {
+            $expected = count($commands);
+            $received = count($executed);
+
             throw new ClientException(
-                "Invalid number of responses [expected: ".count($commands)." - actual: ".count($executed)."]"
+                "Invalid number of responses [expected $expected, received $received]."
             );
         }
 

+ 3 - 1
lib/Predis/Pipeline/ConnectionErrorProof.php

@@ -45,7 +45,9 @@ class ConnectionErrorProof extends Pipeline
         } else if ($connection instanceof ClusterConnectionInterface) {
             return $this->executeCluster($connection, $commands);
         } else {
-            throw new NotSupportedException("Unsupported connection type");
+            $class = get_class($connection);
+
+            throw new NotSupportedException("The connection class '$class' is not supported.");
         }
     }
 

+ 2 - 2
lib/Predis/Pipeline/Pipeline.php

@@ -172,7 +172,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface
     private function setRunning($bool)
     {
         if ($bool && $this->running) {
-            throw new ClientException('This pipeline is already opened');
+            throw new ClientException('The current pipeline context is already being executed.');
         }
 
         $this->running = $bool;
@@ -187,7 +187,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface
     public function execute($callable = null)
     {
         if ($callable && !is_callable($callable)) {
-            throw new InvalidArgumentException('Argument passed must be a callable object');
+            throw new InvalidArgumentException('The argument must be a callable object.');
         }
 
         $exception = null;

+ 6 - 8
lib/Predis/Profile/Factory.php

@@ -65,19 +65,17 @@ final class Factory
      * Registers a new server profile.
      *
      * @param string $alias Profile version or alias.
-     * @param string $profileClass FQN of a class implementing Predis\Profile\ProfileInterface.
+     * @param string $class FQN of a class implementing Predis\Profile\ProfileInterface.
      */
-    public static function define($alias, $profileClass)
+    public static function define($alias, $class)
     {
-        $reflection = new ReflectionClass($profileClass);
+        $reflection = new ReflectionClass($class);
 
         if (!$reflection->isSubclassOf('Predis\Profile\ProfileInterface')) {
-            throw new InvalidArgumentException(
-                "Cannot register '$profileClass' as it is not a valid profile class"
-            );
+            throw new InvalidArgumentException("The class '$class' is not a valid profile class.");
         }
 
-        self::$profiles[$alias] = $profileClass;
+        self::$profiles[$alias] = $class;
     }
 
     /**
@@ -89,7 +87,7 @@ final class Factory
     public static function get($version)
     {
         if (!isset(self::$profiles[$version])) {
-            throw new ClientException("Unknown server profile: $version");
+            throw new ClientException("Unknown server profile: '$version'.");
         }
 
         $profile = self::$profiles[$version];

+ 5 - 5
lib/Predis/Profile/RedisProfile.php

@@ -86,7 +86,7 @@ abstract class RedisProfile implements ProfileInterface
         $commandID = strtoupper($commandID);
 
         if (!isset($this->commands[$commandID])) {
-            throw new ClientException("'$commandID' is not a registered Redis command");
+            throw new ClientException("Command '$commandID' is not a registered Redis command.");
         }
 
         $commandClass = $this->commands[$commandID];
@@ -106,15 +106,15 @@ abstract class RedisProfile implements ProfileInterface
      * @param string $commandID Command ID.
      * @param string $commandClass Fully-qualified name of a Predis\Command\CommandInterface.
      */
-    public function defineCommand($commandID, $commandClass)
+    public function defineCommand($commandID, $class)
     {
-        $reflection = new ReflectionClass($commandClass);
+        $reflection = new ReflectionClass($class);
 
         if (!$reflection->isSubclassOf('Predis\Command\CommandInterface')) {
-            throw new InvalidArgumentException("Cannot register '$commandClass' as it is not a valid Redis command");
+            throw new InvalidArgumentException("The class '$class' is not a valid command class.");
         }
 
-        $this->commands[strtoupper($commandID)] = $commandClass;
+        $this->commands[strtoupper($commandID)] = $class;
     }
 
     /**

+ 1 - 1
lib/Predis/Protocol/Text/Handler/BulkResponse.php

@@ -33,7 +33,7 @@ class BulkResponse implements ResponseHandlerInterface
 
         if ("$length" !== $payload) {
             CommunicationException::handle(new ProtocolException(
-                $connection, "Cannot parse '$payload' as the length of the bulk response"
+                $connection, "Cannot parse '$payload' as a valid length for a bulk response."
             ));
         }
 

+ 1 - 1
lib/Predis/Protocol/Text/Handler/IntegerResponse.php

@@ -35,7 +35,7 @@ class IntegerResponse implements ResponseHandlerInterface
 
         if ($payload !== 'nil') {
             CommunicationException::handle(new ProtocolException(
-                $connection, "Cannot parse '$payload' as a numeric response"
+                $connection, "Cannot parse '$payload' as a valid numeric response."
             ));
         }
 

+ 1 - 1
lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php

@@ -33,7 +33,7 @@ class MultiBulkResponse implements ResponseHandlerInterface
 
         if ("$length" !== $payload) {
             CommunicationException::handle(new ProtocolException(
-                $connection, "Cannot parse '$payload' as the length of the multibulk response"
+                $connection, "Cannot parse '$payload' as a valid length of a multi-bulk response."
             ));
         }
 

+ 1 - 1
lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php

@@ -37,7 +37,7 @@ class StreamableMultiBulkResponse implements ResponseHandlerInterface
 
         if ("$length" != $payload) {
             CommunicationException::handle(new ProtocolException(
-                $connection, "Cannot parse '$payload' as the length of the multibulk response"
+                $connection, "Cannot parse '$payload' as a valid length for a multi-bulk response."
             ));
         }
 

+ 1 - 1
lib/Predis/Protocol/Text/ProtocolProcessor.php

@@ -95,7 +95,7 @@ class ProtocolProcessor implements ProtocolProcessorInterface
 
             default:
                 CommunicationException::handle(new ProtocolException(
-                    $connection, "Unknown prefix: '$prefix'"
+                    $connection, "Unknown response prefix: '$prefix'."
                 ));
         }
     }

+ 2 - 2
lib/Predis/Protocol/Text/ResponseReader.php

@@ -82,13 +82,13 @@ class ResponseReader implements ResponseReaderInterface
         $header = $connection->readLine();
 
         if ($header === '') {
-            $this->onProtocolError($connection, 'Unexpected empty header');
+            $this->onProtocolError($connection, 'Unexpected empty reponse header.');
         }
 
         $prefix = $header[0];
 
         if (!isset($this->handlers[$prefix])) {
-            $this->onProtocolError($connection, "Unknown prefix: '$prefix'");
+            $this->onProtocolError($connection, "Unknown response prefix: '$prefix'.");
         }
 
         $handler = $this->handlers[$prefix];

+ 3 - 3
lib/Predis/PubSub/Consumer.php

@@ -61,7 +61,7 @@ class Consumer extends AbstractConsumer
     {
         if ($client->getConnection() instanceof AggregateConnectionInterface) {
             throw new NotSupportedException(
-                'Cannot initialize a PUB/SUB consumer when using aggregate connections'
+                'Cannot initialize a PUB/SUB consumer over aggregate connections.'
             );
         }
 
@@ -69,7 +69,7 @@ class Consumer extends AbstractConsumer
 
         if ($client->getProfile()->supportsCommands($commands) === false) {
             throw new NotSupportedException(
-                'The current profile does not support PUB/SUB related commands'
+                'The current profile does not support PUB/SUB related commands.'
             );
         }
     }
@@ -137,7 +137,7 @@ class Consumer extends AbstractConsumer
 
             default:
                 throw new ClientException(
-                    "Received an unknown message type {$response[0]} inside PUB/SUB"
+                    "Unknown message type '{$response[0]}' received in the PUB/SUB context."
                 );
         }
     }

+ 1 - 1
lib/Predis/PubSub/DispatcherLoop.php

@@ -45,7 +45,7 @@ class DispatcherLoop
     protected function assertCallback($callable)
     {
         if (!is_callable($callable)) {
-            throw new InvalidArgumentException("A valid callable object must be provided");
+            throw new InvalidArgumentException('The given argument must be a callable object.');
         }
     }
 

+ 1 - 1
lib/Predis/Replication/ReplicationStrategy.php

@@ -46,7 +46,7 @@ class ReplicationStrategy
     {
         if (isset($this->disallowed[$id = $command->getId()])) {
             throw new NotSupportedException(
-                "The command $id is not allowed in replication mode"
+                "The command '$id' is not allowed in replication mode."
             );
         }
 

+ 2 - 4
lib/Predis/Response/Iterator/MultiBulkTuple.php

@@ -50,14 +50,12 @@ class MultiBulkTuple extends MultiBulk implements OuterIterator
     {
         if ($iterator->getPosition() !== 0) {
             throw new RuntimeException(
-                'Cannot initialize a tuple iterator with an already initiated iterator'
+                'Cannot initialize a tuple iterator using an already initiated iterator.'
             );
         }
 
         if (($size = count($iterator)) % 2 !== 0) {
-            throw new UnexpectedValueException(
-                "Invalid response size for a tuple iterator [$size]"
-            );
+            throw new UnexpectedValueException("Invalid response size for a tuple iterator.");
         }
     }
 

+ 13 - 13
lib/Predis/Transaction/MultiExec.php

@@ -69,13 +69,13 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     {
         if ($client->getConnection() instanceof AggregateConnectionInterface) {
             throw new NotSupportedException(
-                'Cannot initialize a MULTI/EXEC transaction when using aggregate connections'
+                'Cannot initialize a MULTI/EXEC transaction over aggregate connections.'
             );
         }
 
         if (!$client->getProfile()->supportsCommands(array('multi', 'exec', 'discard'))) {
             throw new NotSupportedException(
-                'The current profile does not support MULTI, EXEC and DISCARD'
+                'The current profile does not support MULTI, EXEC and DISCARD.'
             );
         }
     }
@@ -198,7 +198,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
         }
 
         if ($response != 'QUEUED' && !$response instanceof StatusResponse) {
-            $this->onProtocolError('The server did not respond with a QUEUED status response');
+            $this->onProtocolError('The server did not return a +QUEUED status response.');
         }
 
         $this->commands->enqueue($command);
@@ -215,11 +215,11 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     public function watch($keys)
     {
         if (!$this->client->getProfile()->supportsCommand('WATCH')) {
-            throw new NotSupportedException('WATCH is not supported by the current profile');
+            throw new NotSupportedException('WATCH is not supported by the current profile.');
         }
 
         if ($this->state->isWatchAllowed()) {
-            throw new ClientException('WATCH after MULTI is not allowed');
+            throw new ClientException('Sending WATCH after MULTI is not allowed.');
         }
 
         $response = $this->call('watch', array($keys));
@@ -254,7 +254,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     public function unwatch()
     {
         if (!$this->client->getProfile()->supportsCommand('WATCH')) {
-            throw new NotSupportedException('UNWATCH is not supported by the current profile');
+            throw new NotSupportedException('UNWATCH is not supported by the current profile.');
         }
 
         $this->state->unflag(MultiExecState::WATCH);
@@ -300,27 +300,27 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
     {
         if ($this->state->isExecuting()) {
             throw new ClientException(
-                'Cannot invoke "execute" or "exec" inside an active transaction context'
+                'Cannot invoke "execute" or "exec" inside an active transaction context.'
             );
         }
 
         if ($callable) {
             if (!is_callable($callable)) {
-                throw new InvalidArgumentException('Argument passed must be a callable object');
+                throw new InvalidArgumentException('The argument must be a callable object.');
             }
 
             if (!$this->commands->isEmpty()) {
                 $this->discard();
 
                 throw new ClientException(
-                    'Cannot execute a transaction block after using fluent interface
-                ');
+                    'Cannot execute a transaction block after using fluent interface.'
+                );
             }
         } else if ($this->attempts) {
             $this->discard();
 
             throw new InvalidArgumentException(
-                'Automatic retries can be used only when a callable block is provided'
+                'Automatic retries are supported only when a callable block is provided.'
             );
         }
     }
@@ -356,7 +356,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
             if ($execResponse === null) {
                 if ($attempts === 0) {
                     throw new AbortedMultiExecException(
-                        $this, 'The current transaction has been aborted by the server'
+                        $this, 'The current transaction has been aborted by the server.'
                     );
                 }
 
@@ -373,7 +373,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
         $size = count($execResponse);
 
         if ($size !== count($commands)) {
-            $this->onProtocolError('EXEC returned an unexpected number of response items');
+            $this->onProtocolError('EXEC returned an unexpected number of response items.');
         }
 
         for ($i = 0; $i < $size; $i++) {

+ 1 - 1
tests/PHPUnit/PredisConnectionTestCase.php

@@ -50,7 +50,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
     /**
      * @group connected
      * @expectedException Predis\ClientException
-     * @expectedExceptionMessage Connection already estabilished
+     * @expectedExceptionMessage Connection already estabilished.
      */
     public function testThrowsExceptionOnConnectWhenAlreadyConnected()
     {

+ 2 - 2
tests/PHPUnit/PredisProfileTestCase.php

@@ -149,7 +149,7 @@ abstract class PredisProfileTestCase extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Cannot register 'stdClass' as it is not a valid Redis command
+     * @expectedExceptionMessage The class 'stdClass' is not a valid command class.
      */
     public function testDefineInvalidCommand()
     {
@@ -188,7 +188,7 @@ abstract class PredisProfileTestCase extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\ClientException
-     * @expectedExceptionMessage 'UNKNOWN' is not a registered Redis command
+     * @expectedExceptionMessage Command 'UNKNOWN' is not a registered Redis command.
      */
     public function testCreateUndefinedCommand()
     {

+ 4 - 4
tests/Predis/ClientTest.php

@@ -216,7 +216,7 @@ class ClientTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException UnexpectedValueException
-     * @expectedExceptionMessage The callable connection initializer returned an invalid type
+     * @expectedExceptionMessage The callable connection initializer returned an invalid type.
      */
     public function testConstructorWithCallableConnectionInitializerThrowsExceptionOnInvalidReturnType()
     {
@@ -296,7 +296,7 @@ class ClientTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException UnexpectedValueException
-     * @expectedExceptionMessage The callable connection initializer returned an invalid type
+     * @expectedExceptionMessage The callable connection initializer returned an invalid type.
      */
     public function testConstructorWithArrayAndOptionAggregateThrowsExceptionOnInvalidReturnType()
     {
@@ -568,7 +568,7 @@ class ClientTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\ClientException
-     * @expectedExceptionMessage 'INVALIDCOMMAND' is not a registered Redis command
+     * @expectedExceptionMessage Command 'INVALIDCOMMAND' is not a registered Redis command.
      */
     public function testThrowsExceptionOnNonRegisteredRedisCommand()
     {
@@ -594,7 +594,7 @@ class ClientTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage Retrieving connections by ID is supported only when using aggregate connections
+     * @expectedExceptionMessage Retrieving connections by ID is supported only by aggregate connections.
      */
     public function testGetConnectionByIdWorksOnlyWithAggregateConnections()
     {

+ 2 - 4
tests/Predis/Cluster/Distributor/EmptyRingExceptionTest.php

@@ -20,12 +20,10 @@ class EmptyRingExceptionTest extends PredisTestCase
 {
     /**
      * @group disconnected
+     * @expectedException Predis\Cluster\Distributor\EmptyRingException
      */
     public function testExceptionMessage()
     {
-        $message = 'Empty Ring';
-        $this->setExpectedException('Predis\Cluster\Distributor\EmptyRingException', $message);
-
-        throw new EmptyRingException($message);
+        throw new EmptyRingException('Empty Ring');
     }
 }

+ 1 - 1
tests/Predis/Collection/Iterator/HashKeyTest.php

@@ -23,7 +23,7 @@ class HashKeyTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The specified server profile does not support the `HSCAN` command.
+     * @expectedExceptionMessage The current profile does not support 'HSCAN'.
      */
     public function testThrowsExceptionOnInvalidProfile()
     {

+ 1 - 1
tests/Predis/Collection/Iterator/KeyspaceTest.php

@@ -23,7 +23,7 @@ class KeyspaceTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The specified server profile does not support the `SCAN` command.
+     * @expectedExceptionMessage The current profile does not support 'SCAN'.
      */
     public function testThrowsExceptionOnInvalidProfile()
     {

+ 1 - 1
tests/Predis/Collection/Iterator/SetKeyTest.php

@@ -23,7 +23,7 @@ class SetKeyTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The specified server profile does not support the `SSCAN` command.
+     * @expectedExceptionMessage The current profile does not support 'SSCAN'.
      */
     public function testThrowsExceptionOnInvalidProfile()
     {

+ 1 - 1
tests/Predis/Collection/Iterator/SortedSetKeyTest.php

@@ -23,7 +23,7 @@ class SortedSetTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The specified server profile does not support the `ZSCAN` command.
+     * @expectedExceptionMessage The current profile does not support 'ZSCAN'.
      */
     public function testThrowsExceptionOnInvalidProfile()
     {

+ 1 - 1
tests/Predis/Command/RawCommandTest.php

@@ -61,7 +61,7 @@ class RawCommandTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Arguments array is missing the command ID
+     * @expectedExceptionMessage The arguments array must contain at least the command ID.
      */
     public function testExceptionOnMissingCommandID()
     {

+ 2 - 2
tests/Predis/Connection/ComposableStreamConnectionTest.php

@@ -40,7 +40,7 @@ class ComposableStreamConnectionTest extends PredisConnectionTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Invalid scheme: udp
+     * @expectedExceptionMessage Invalid scheme: 'udp'.
      */
     public function testThrowsExceptionOnInvalidScheme()
     {
@@ -83,7 +83,7 @@ class ComposableStreamConnectionTest extends PredisConnectionTestCase
     /**
      * @group connected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Unknown prefix: 'P'
+     * @expectedExceptionMessage Unknown response prefix: 'P'.
      */
     public function testThrowsExceptionOnProtocolDesynchronizationErrors()
     {

+ 8 - 9
tests/Predis/Connection/FactoryTest.php

@@ -155,14 +155,13 @@ class FactoryTest extends PredisTestCase
 
     /**
      * @group disconnected
+     * @expectedException InvalidArgumentException
+     * @expecteExceptionMessage Unknown connection scheme: 'unknown'.
      */
     public function testCreateUndefinedConnection()
     {
-        $scheme = 'unknown';
-        $this->setExpectedException('InvalidArgumentException', "Unknown connection scheme: $scheme");
-
         $factory = new Factory();
-        $factory->create(new Parameters(array('scheme' => $scheme)));
+        $factory->create(new Parameters(array('scheme' => 'unknown')));
     }
 
     /**
@@ -212,22 +211,21 @@ class FactoryTest extends PredisTestCase
 
     /**
      * @group disconnected
+     * @expectedException InvalidArgumentException
      */
     public function testDefineConnectionWithInvalidArgument()
     {
-        $this->setExpectedException('InvalidArgumentException');
-
         $factory = new Factory();
         $factory->define('foobar', new \stdClass());
     }
 
     /**
      * @group disconnected
+     * @expectedException InvalidArgumentException
+     * @expecteExceptionMessage Unknown connection scheme: 'tcp'.
      */
     public function testUndefineDefinedConnection()
     {
-        $this->setExpectedException('InvalidArgumentException', 'Unknown connection scheme: tcp');
-
         $factory = new Factory();
         $factory->undefine('tcp');
         $factory->create('tcp://127.0.0.1');
@@ -247,6 +245,8 @@ class FactoryTest extends PredisTestCase
 
     /**
      * @group disconnected
+     * @expectedException InvalidArgumentException
+     * @expecteExceptionMessage Unknown connection scheme: 'redis'.
      */
     public function testDefineAndUndefineConnection()
     {
@@ -258,7 +258,6 @@ class FactoryTest extends PredisTestCase
         $this->assertInstanceOf($connectionClass, $factory->create('redis://127.0.0.1'));
 
         $factory->undefine('redis');
-        $this->setExpectedException('InvalidArgumentException', 'Unknown connection scheme: redis');
         $factory->create('redis://127.0.0.1');
     }
 

+ 5 - 5
tests/Predis/Connection/MasterSlaveReplicationTest.php

@@ -65,7 +65,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException RuntimeException
-     * @expectedExceptionMessage Replication needs a master and at least one slave
+     * @expectedExceptionMessage Replication needs one master and at least one slave.
      */
     public function testThrowsExceptionOnEmptyReplication()
     {
@@ -76,7 +76,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException RuntimeException
-     * @expectedExceptionMessage Replication needs a master and at least one slave
+     * @expectedExceptionMessage Replication needs one master and at least one slave.
      */
     public function testThrowsExceptionOnMissingMaster()
     {
@@ -89,7 +89,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException RuntimeException
-     * @expectedExceptionMessage Replication needs a master and at least one slave
+     * @expectedExceptionMessage Replication needs one master and at least one slave.
      */
     public function testThrowsExceptionOnMissingSlave()
     {
@@ -200,7 +200,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage The specified connection is not valid
+     * @expectedExceptionMessage Invalid connection or connection not found.
      */
     public function testThrowsErrorWhenSwitchingToUnknownConnection()
     {
@@ -435,7 +435,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The command INFO is not allowed in replication mode
+     * @expectedExceptionMessage The command 'INFO' is not allowed in replication mode.
      */
     public function testThrowsExceptionOnNonSupportedCommand()
     {

+ 1 - 1
tests/Predis/Connection/PhpiredisSocketConnectionTest.php

@@ -40,7 +40,7 @@ class PhpiredisSocketConnectionTest extends PredisConnectionTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Invalid scheme: udp
+     * @expectedExceptionMessage Invalid scheme: 'udp'.
      */
     public function testThrowsExceptionOnInvalidScheme()
     {

+ 1 - 1
tests/Predis/Connection/PhpiredisStreamConnectionTest.php

@@ -40,7 +40,7 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Invalid scheme: udp
+     * @expectedExceptionMessage Invalid scheme: 'udp'.
      */
     public function testThrowsExceptionOnInvalidScheme()
     {

+ 1 - 1
tests/Predis/Connection/PredisClusterTest.php

@@ -256,7 +256,7 @@ class PredisClusterTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage Cannot use PING with a cluster of connections
+     * @expectedExceptionMessage Cannot use 'PING' over clusters of connections.
      */
     public function testThrowsExceptionOnNonShardableCommand()
     {

+ 1 - 1
tests/Predis/Connection/RedisClusterTest.php

@@ -604,7 +604,7 @@ class RedisClusterTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage Cannot use PING with redis-cluster
+     * @expectedExceptionMessage Cannot use 'PING' with redis-cluster.
      */
     public function testThrowsExceptionOnNonSupportedCommand()
     {

+ 2 - 2
tests/Predis/Connection/StreamConnectionTest.php

@@ -40,7 +40,7 @@ class StreamConnectionTest extends PredisConnectionTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Invalid scheme: udp
+     * @expectedExceptionMessage Invalid scheme: 'udp'.
      */
     public function testThrowsExceptionOnInvalidScheme()
     {
@@ -86,7 +86,7 @@ class StreamConnectionTest extends PredisConnectionTestCase
     /**
      * @group connected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Unknown prefix: 'P'
+     * @expectedExceptionMessage Unknown response prefix: 'P'.
      */
     public function testThrowsExceptionOnProtocolDesynchronizationErrors()
     {

+ 5 - 5
tests/Predis/Connection/WebdisConnectionTest.php

@@ -35,7 +35,7 @@ class WebdisConnectionTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::writeRequest() is not supported
+     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::writeRequest() is not supported.
      */
     public function testWritingCommandsIsNotSupported()
     {
@@ -57,7 +57,7 @@ class WebdisConnectionTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::read() is not supported
+     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::read() is not supported.
      */
     public function testReadingFromConnectionIsNotSupported()
     {
@@ -68,7 +68,7 @@ class WebdisConnectionTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::addConnectCommand() is not supported
+     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::addConnectCommand() is not supported.
      *
      */
     public function testAddingConnectCommandsIsNotSupported()
@@ -80,7 +80,7 @@ class WebdisConnectionTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage Disabled command: SELECT
+     * @expectedExceptionMessage Command 'SELECT' is not allowed by Webdis.
      */
     public function testRejectCommandSelect()
     {
@@ -91,7 +91,7 @@ class WebdisConnectionTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage Disabled command: AUTH
+     * @expectedExceptionMessage Command 'AUTH' is not allowed by Webdis.
      */
     public function testRejectCommandAuth()
     {

+ 2 - 2
tests/Predis/Monitor/ConsumerTest.php

@@ -24,7 +24,7 @@ class ConsumerTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The current profile does not support the MONITOR command
+     * @expectedExceptionMessage The current profile does not support 'MONITOR'.
      */
     public function testMonitorConsumerRequireMonitorCommand()
     {
@@ -41,7 +41,7 @@ class ConsumerTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage Cannot initialize a monitor consumer when using aggregate connections
+     * @expectedExceptionMessage Cannot initialize a monitor consumer over aggregate connections.
      */
     public function testMonitorConsumerDoesNotWorkOnClusters()
     {

+ 2 - 2
tests/Predis/Pipeline/AtomicTest.php

@@ -51,7 +51,7 @@ class AtomicTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\ClientException
-     * @expectedExceptionMessage The underlying transaction has been aborted by the server
+     * @expectedExceptionMessage The underlying transaction has been aborted by the server.
      */
     public function testThrowsExceptionOnAbortedTransaction()
     {
@@ -150,7 +150,7 @@ class AtomicTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\ClientException
-     * @expectedExceptionMessage Predis\Pipeline\Atomic can be used only with connections to single nodes
+     * @expectedExceptionMessage The class 'Predis\Pipeline\Atomic' does not support aggregate connections.
      */
     public function testExecutorWithAggregateConnection()
     {

+ 2 - 2
tests/Predis/Profile/FactoryTest.php

@@ -65,7 +65,7 @@ class FactoryTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\ClientException
-     * @expectedExceptionMessage Unknown server profile: 1.0
+     * @expectedExceptionMessage Unknown server profile: '1.0'.
      */
     public function testGetUndefinedProfile()
     {
@@ -87,7 +87,7 @@ class FactoryTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Cannot register 'stdClass' as it is not a valid profile class
+     * @expectedExceptionMessage The class 'stdClass' is not a valid profile class.
      */
     public function testDefineInvalidProfile()
     {

+ 1 - 1
tests/Predis/Protocol/Text/Handler/BulkResponseTest.php

@@ -75,7 +75,7 @@ class BulkResponseTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Cannot parse 'invalid' as the length of the bulk response
+     * @expectedExceptionMessage Cannot parse 'invalid' as a valid length for a bulk response.
      */
     public function testInvalidLength()
     {

+ 1 - 1
tests/Predis/Protocol/Text/Handler/IntegerResponseTest.php

@@ -54,7 +54,7 @@ class IntegerResponseTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Cannot parse 'invalid' as a numeric response
+     * @expectedExceptionMessage Cannot parse 'invalid' as a valid numeric response.
      */
     public function testInvalid()
     {

+ 1 - 1
tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php

@@ -68,7 +68,7 @@ class MultiBulkResponseTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Cannot parse 'invalid' as the length of the multibulk response
+     * @expectedExceptionMessage Cannot parse 'invalid' as a valid length of a multi-bulk response.
      */
     public function testInvalid()
     {

+ 1 - 1
tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponseTest.php

@@ -36,7 +36,7 @@ class StreamableMultiBulkResponseTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Cannot parse 'invalid' as the length of the multibulk response
+     * @expectedExceptionMessage Cannot parse 'invalid' as a valid length for a multi-bulk response.
      */
     public function testInvalid()
     {

+ 1 - 1
tests/Predis/Protocol/Text/ProtocolProcessorTest.php

@@ -103,7 +103,7 @@ class ProtocolProcessorTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Unknown prefix: '!'
+     * @expectedExceptionMessage Unknown response prefix: '!'.
      */
     public function testUnknownResponsePrefix()
     {

+ 2 - 2
tests/Predis/Protocol/Text/ResponseReaderTest.php

@@ -89,7 +89,7 @@ class ResponseReaderTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Unexpected empty header
+     * @expectedExceptionMessage Unexpected empty reponse header.
      */
     public function testEmptyResponseHeader()
     {
@@ -106,7 +106,7 @@ class ResponseReaderTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\Protocol\ProtocolException
-     * @expectedExceptionMessage Unknown prefix: '!'
+     * @expectedExceptionMessage Unknown response prefix: '!'.
      */
     public function testUnknownResponsePrefix()
     {

+ 2 - 2
tests/Predis/PubSub/ConsumerTest.php

@@ -24,7 +24,7 @@ class ConsumerTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The current profile does not support PUB/SUB related commands
+     * @expectedExceptionMessage The current profile does not support PUB/SUB related commands.
      */
     public function testPubSubConsumerRequirePubSubRelatedCommand()
     {
@@ -40,7 +40,7 @@ class ConsumerTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage Cannot initialize a PUB/SUB consumer when using aggregate connections
+     * @expectedExceptionMessage Cannot initialize a PUB/SUB consumer over aggregate connections.
      */
     public function testPubSubConsumerDoesNotWorkOnClusters()
     {

+ 1 - 1
tests/Predis/Replication/ReplicationStrategyTest.php

@@ -80,7 +80,7 @@ class ReplicationStrategyTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The command INFO is not allowed in replication mode
+     * @expectedExceptionMessage The command 'INFO' is not allowed in replication mode.
      */
     public function testUsingDisallowedCommandThrowsException()
     {

+ 2 - 2
tests/Predis/Response/Iterator/MultiBulkTupleTest.php

@@ -24,7 +24,7 @@ class MultiBulkTupleTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException RuntimeException
-     * @expectedExceptionMessage Cannot initialize a tuple iterator with an already initiated iterator
+     * @expectedExceptionMessage Cannot initialize a tuple iterator using an already initiated iterator.
      */
     public function testInitiatedMultiBulkIteratorsAreNotValid()
     {
@@ -38,7 +38,7 @@ class MultiBulkTupleTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException UnexpectedValueException
-     * @expectedExceptionMessage Invalid response size for a tuple iterator [3]
+     * @expectedExceptionMessage Invalid response size for a tuple iterator.
      */
     public function testMultiBulkWithOddSizesAreInvalid()
     {

+ 5 - 5
tests/Predis/Transaction/MultiExecTest.php

@@ -24,7 +24,7 @@ class MultiExecTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The current profile does not support MULTI, EXEC and DISCARD
+     * @expectedExceptionMessage The current profile does not support MULTI, EXEC and DISCARD.
      */
     public function testThrowsExceptionOnUnsupportedMultiExecInProfile()
     {
@@ -36,7 +36,7 @@ class MultiExecTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage WATCH is not supported by the current profile
+     * @expectedExceptionMessage WATCH is not supported by the current profile.
      */
     public function testThrowsExceptionOnUnsupportedWatchInProfile()
     {
@@ -50,7 +50,7 @@ class MultiExecTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage UNWATCH is not supported by the current profile
+     * @expectedExceptionMessage UNWATCH is not supported by the current profile.
      */
     public function testThrowsExceptionOnUnsupportedUnwatchInProfile()
     {
@@ -142,7 +142,7 @@ class MultiExecTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\ClientException
-     * @expectedExceptionMessage Cannot invoke "execute" or "exec" inside an active transaction context
+     * @expectedExceptionMessage Cannot invoke "execute" or "exec" inside an active transaction context.
      */
     public function testThrowsExceptionOnExecInsideTransactionBlock()
     {
@@ -369,7 +369,7 @@ class MultiExecTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Automatic retries can be used only when a callable block is provided
+     * @expectedExceptionMessage Automatic retries are supported only when a callable block is provided.
      */
     public function testThrowsExceptionOnAutomaticRetriesWithFluentInterface()
     {