Remove unneeded "use" imports.

This commit is contained in:
Daniele Alessandri
2015-07-24 19:05:28 +02:00
parent c436e01353
commit 7282ca2b52
40 changed files with 78 additions and 149 deletions
+4 -6
View File
@@ -11,8 +11,6 @@
namespace Predis;
use InvalidArgumentException;
use UnexpectedValueException;
use Predis\Command\CommandInterface;
use Predis\Command\RawCommand;
use Predis\Command\ScriptCommand;
@@ -80,7 +78,7 @@ class Client implements ClientInterface
return $options;
}
throw new InvalidArgumentException('Invalid type for client options.');
throw new \InvalidArgumentException('Invalid type for client options.');
}
/**
@@ -142,7 +140,7 @@ class Client implements ClientInterface
return $connection;
}
throw new InvalidArgumentException('Invalid type for connection parameters.');
throw new \InvalidArgumentException('Invalid type for connection parameters.');
}
/**
@@ -159,7 +157,7 @@ class Client implements ClientInterface
$connection = call_user_func_array($callable, func_get_args());
if (!$connection instanceof ConnectionInterface) {
throw new UnexpectedValueException(
throw new \UnexpectedValueException(
'The callable connection initializer returned an invalid type.'
);
}
@@ -198,7 +196,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);
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Cluster;
use InvalidArgumentException;
use Predis\Command\CommandInterface;
use Predis\Command\ScriptCommand;
@@ -202,7 +201,7 @@ abstract class ClusterStrategy implements StrategyInterface
}
if (!is_callable($callback)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'The argument must be a callable object or NULL.'
);
}
@@ -11,13 +11,11 @@
namespace Predis\Cluster\Distributor;
use Exception;
/**
* Exception class that identifies empty rings.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class EmptyRingException extends Exception
class EmptyRingException extends \Exception
{
}
@@ -11,7 +11,6 @@
namespace Predis\Collection\Iterator;
use Iterator;
use Predis\ClientInterface;
use Predis\NotSupportedException;
@@ -28,7 +27,7 @@ use Predis\NotSupportedException;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
abstract class CursorBasedIterator implements Iterator
abstract class CursorBasedIterator implements \Iterator
{
protected $client;
protected $match;
+2 -4
View File
@@ -11,8 +11,6 @@
namespace Predis\Collection\Iterator;
use InvalidArgumentException;
use Iterator;
use Predis\ClientInterface;
use Predis\NotSupportedException;
@@ -30,7 +28,7 @@ use Predis\NotSupportedException;
*
* @link http://redis.io/commands/lrange
*/
class ListKey implements Iterator
class ListKey implements \Iterator
{
protected $client;
protected $count;
@@ -54,7 +52,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;
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Command\Processor;
use InvalidArgumentException;
use Predis\Command\CommandInterface;
use Predis\Command\PrefixableCommandInterface;
@@ -220,7 +219,7 @@ class KeyPrefixProcessor implements ProcessorInterface
}
if (!is_callable($callback)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'Callback must be a valid callable object or NULL'
);
}
+4 -7
View File
@@ -11,9 +11,6 @@
namespace Predis\Command\Processor;
use ArrayAccess;
use ArrayIterator;
use InvalidArgumentException;
use Predis\Command\CommandInterface;
/**
@@ -21,7 +18,7 @@ use Predis\Command\CommandInterface;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class ProcessorChain implements ArrayAccess, ProcessorInterface
class ProcessorChain implements \ArrayAccess, ProcessorInterface
{
private $processors = array();
@@ -74,11 +71,11 @@ class ProcessorChain implements ArrayAccess, ProcessorInterface
/**
* Returns an iterator over the list of command processor in the chain.
*
* @return ArrayIterator
* @return \ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->processors);
return new \ArrayIterator($this->processors);
}
/**
@@ -113,7 +110,7 @@ class ProcessorChain implements ArrayAccess, ProcessorInterface
public function offsetSet($index, $processor)
{
if (!$processor instanceof ProcessorInterface) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'A processor chain accepts only instances of '.
"'Predis\Command\Processor\ProcessorInterface'."
);
+1 -3
View File
@@ -11,8 +11,6 @@
namespace Predis\Command;
use InvalidArgumentException;
/**
* Class for generic "anonymous" Redis commands.
*
@@ -37,7 +35,7 @@ class RawCommand implements CommandInterface
public function __construct(array $arguments)
{
if (!$arguments) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'The arguments array must contain at least the command ID.'
);
}
+2 -3
View File
@@ -11,7 +11,6 @@
namespace Predis;
use Exception;
use Predis\Connection\NodeConnectionInterface;
/**
@@ -27,13 +26,13 @@ abstract class CommunicationException extends PredisException
* @param NodeConnectionInterface $connection Connection that generated the exception.
* @param string $message Error message.
* @param int $code Error code.
* @param Exception $innerException Inner exception for wrapping the original error.
* @param \Exception $innerException Inner exception for wrapping the original error.
*/
public function __construct(
NodeConnectionInterface $connection,
$message = null,
$code = null,
Exception $innerException = null
\Exception $innerException = null
) {
parent::__construct($message, $code, $innerException);
$this->connection = $connection;
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Configuration;
use InvalidArgumentException;
use Predis\Connection\Aggregate\ClusterInterface;
use Predis\Connection\Aggregate\PredisCluster;
use Predis\Connection\Aggregate\RedisCluster;
@@ -59,7 +58,7 @@ class ClusterOption implements OptionInterface
}
if (!$value instanceof ClusterInterface) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
"An instance of type 'Predis\Connection\Aggregate\ClusterInterface' was expected."
);
}
@@ -11,7 +11,6 @@
namespace Predis\Configuration;
use InvalidArgumentException;
use Predis\Connection\Factory;
use Predis\Connection\FactoryInterface;
@@ -39,7 +38,7 @@ class ConnectionFactoryOption implements OptionInterface
return $factory;
} else {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'Invalid value provided for the connections option.'
);
}
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Configuration;
use InvalidArgumentException;
use Predis\Profile\Factory;
use Predis\Profile\ProfileInterface;
use Predis\Profile\RedisProfile;
@@ -51,7 +50,7 @@ class ProfileOption implements OptionInterface
$value = Factory::get($value);
$this->setProcessors($options, $value);
} elseif (!$value instanceof ProfileInterface) {
throw new InvalidArgumentException('Invalid value for the profile option.');
throw new \InvalidArgumentException('Invalid value for the profile option.');
}
return $value;
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Configuration;
use InvalidArgumentException;
use Predis\Connection\Aggregate\MasterSlaveReplication;
use Predis\Connection\Aggregate\ReplicationInterface;
@@ -47,7 +46,7 @@ class ReplicationOption implements OptionInterface
return $asbool ? $this->getDefault($options) : null;
}
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
"An instance of type 'Predis\Connection\Aggregate\ReplicationInterface' was expected."
);
}
@@ -11,8 +11,6 @@
namespace Predis\Connection\Aggregate;
use InvalidArgumentException;
use RuntimeException;
use Predis\Command\CommandInterface;
use Predis\Connection\NodeConnectionInterface;
use Predis\Replication\ReplicationStrategy;
@@ -45,7 +43,7 @@ class MasterSlaveReplication implements ReplicationInterface
protected function check()
{
if (!isset($this->master) || !$this->slaves) {
throw new RuntimeException('Replication needs one master and at least one slave.');
throw new \RuntimeException('Replication needs one master and at least one slave.');
}
}
@@ -147,7 +145,7 @@ class MasterSlaveReplication implements ReplicationInterface
$connection = $this->getConnectionById($connection);
}
if ($connection !== $this->master && !in_array($connection, $this->slaves, true)) {
throw new InvalidArgumentException('Invalid connection or connection not found.');
throw new \InvalidArgumentException('Invalid connection or connection not found.');
}
$this->current = $connection;
+2 -5
View File
@@ -11,9 +11,6 @@
namespace Predis\Connection\Aggregate;
use ArrayIterator;
use Countable;
use IteratorAggregate;
use Predis\NotSupportedException;
use Predis\Cluster\PredisStrategy;
use Predis\Cluster\StrategyInterface;
@@ -28,7 +25,7 @@ use Predis\Connection\NodeConnectionInterface;
*
* @todo Add the ability to remove connections from pool.
*/
class PredisCluster implements ClusterInterface, IteratorAggregate, Countable
class PredisCluster implements ClusterInterface, \IteratorAggregate, \Countable
{
private $pool;
private $strategy;
@@ -191,7 +188,7 @@ class PredisCluster implements ClusterInterface, IteratorAggregate, Countable
*/
public function getIterator()
{
return new ArrayIterator($this->pool);
return new \ArrayIterator($this->pool);
}
/**
+4 -8
View File
@@ -11,10 +11,6 @@
namespace Predis\Connection\Aggregate;
use ArrayIterator;
use Countable;
use IteratorAggregate;
use OutOfBoundsException;
use Predis\NotSupportedException;
use Predis\Cluster\StrategyInterface;
use Predis\Cluster\RedisStrategy as RedisClusterStrategy;
@@ -46,7 +42,7 @@ use Predis\Response\ErrorInterface as ErrorResponseInterface;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
class RedisCluster implements ClusterInterface, \IteratorAggregate, \Countable
{
private $useClusterSlots = true;
private $defaultParameters = array();
@@ -236,7 +232,7 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
$last < 0x0000 || $last > 0x3FFF ||
$last < $first
) {
throw new OutOfBoundsException(
throw new \OutOfBoundsException(
"Invalid slot range for $connection: [$first-$last]."
);
}
@@ -324,7 +320,7 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
public function getConnectionBySlot($slot)
{
if ($slot < 0x0000 || $slot > 0x3FFF) {
throw new OutOfBoundsException("Invalid slot [$slot].");
throw new \OutOfBoundsException("Invalid slot [$slot].");
}
if (isset($this->slots[$slot])) {
@@ -494,7 +490,7 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
*/
public function getIterator()
{
return new ArrayIterator(array_values($this->pool));
return new \ArrayIterator(array_values($this->pool));
}
/**
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Connection;
use InvalidArgumentException;
use Predis\Command\CommandInterface;
use Predis\Protocol\ProtocolProcessorInterface;
use Predis\Protocol\Text\ProtocolProcessor as TextProtocolProcessor;
@@ -60,7 +59,7 @@ class CompositeStreamConnection extends StreamConnection implements CompositeCon
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 = '';
+4 -7
View File
@@ -11,9 +11,6 @@
namespace Predis\Connection;
use InvalidArgumentException;
use UnexpectedValueException;
use ReflectionClass;
use Predis\Command\RawCommand;
/**
@@ -47,10 +44,10 @@ class Factory implements FactoryInterface
return $initializer;
}
$class = new ReflectionClass($initializer);
$class = new \ReflectionClass($initializer);
if (!$class->isSubclassOf('Predis\Connection\NodeConnectionInterface')) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'A connection initializer must be a valid connection class or a callable object.'
);
}
@@ -86,7 +83,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];
@@ -99,7 +96,7 @@ class Factory implements FactoryInterface
}
if (!$connection instanceof NodeConnectionInterface) {
throw new UnexpectedValueException(
throw new \UnexpectedValueException(
'Objects returned by connection initializers must implement '.
"'Predis\Connection\NodeConnectionInterface'."
);
+2 -4
View File
@@ -11,8 +11,6 @@
namespace Predis\Connection;
use InvalidArgumentException;
/**
* Container for connection parameters used to initialize connections to Redis.
*
@@ -87,7 +85,7 @@ class Parameters implements ParametersInterface
}
if (!$parsed = parse_url($uri)) {
throw new InvalidArgumentException("Invalid parameters URI: $uri");
throw new \InvalidArgumentException("Invalid parameters URI: $uri");
}
if (isset($parsed['query'])) {
@@ -120,7 +118,7 @@ class Parameters implements ParametersInterface
public static function parseIANA($uri)
{
if (!$parsed = parse_url($uri)) {
throw new InvalidArgumentException("Invalid parameters URI: $uri");
throw new \InvalidArgumentException("Invalid parameters URI: $uri");
}
if (isset($parsed['query'])) {
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Connection;
use InvalidArgumentException;
use Predis\NotSupportedException;
use Predis\Command\CommandInterface;
use Predis\Protocol\ProtocolException;
@@ -60,7 +59,7 @@ class WebdisConnection implements NodeConnectionInterface
$this->assertExtensions();
if ($parameters->scheme !== 'http') {
throw new InvalidArgumentException("Invalid scheme: '{$parameters->scheme}'.");
throw new \InvalidArgumentException("Invalid scheme: '{$parameters->scheme}'.");
}
$this->parameters = $parameters;
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Monitor;
use Iterator;
use Predis\ClientInterface;
use Predis\NotSupportedException;
use Predis\Connection\AggregateConnectionInterface;
@@ -21,7 +20,7 @@ use Predis\Connection\AggregateConnectionInterface;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class Consumer implements Iterator
class Consumer implements \Iterator
{
private $client;
private $valid;
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Pipeline;
use SplQueue;
use Predis\ClientException;
use Predis\ClientInterface;
use Predis\Connection\ConnectionInterface;
@@ -60,7 +59,7 @@ class Atomic extends Pipeline
/**
* {@inheritdoc}
*/
protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
{
$profile = $this->getClient()->getProfile();
$connection->executeCommand($profile->createCommand('multi'));
+3 -4
View File
@@ -11,7 +11,6 @@
namespace Predis\Pipeline;
use SplQueue;
use Predis\NotSupportedException;
use Predis\CommunicationException;
use Predis\Connection\ConnectionInterface;
@@ -39,7 +38,7 @@ class ConnectionErrorProof extends Pipeline
/**
* {@inheritdoc}
*/
protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
{
if ($connection instanceof NodeConnectionInterface) {
return $this->executeSingleNode($connection, $commands);
@@ -55,7 +54,7 @@ class ConnectionErrorProof extends Pipeline
/**
* {@inheritdoc}
*/
protected function executeSingleNode(NodeConnectionInterface $connection, SplQueue $commands)
protected function executeSingleNode(NodeConnectionInterface $connection, \SplQueue $commands)
{
$responses = array();
$sizeOfPipe = count($commands);
@@ -87,7 +86,7 @@ class ConnectionErrorProof extends Pipeline
/**
* {@inheritdoc}
*/
protected function executeCluster(ClusterInterface $connection, SplQueue $commands)
protected function executeCluster(ClusterInterface $connection, \SplQueue $commands)
{
$responses = array();
$sizeOfPipe = count($commands);
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Pipeline;
use SplQueue;
use Predis\Connection\ConnectionInterface;
/**
@@ -24,7 +23,7 @@ class FireAndForget extends Pipeline
/**
* {@inheritdoc}
*/
protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
{
while (!$commands->isEmpty()) {
$connection->writeRequest($commands->dequeue());
+8 -11
View File
@@ -11,9 +11,6 @@
namespace Predis\Pipeline;
use Exception;
use InvalidArgumentException;
use SplQueue;
use Predis\ClientContextInterface;
use Predis\ClientException;
use Predis\ClientInterface;
@@ -46,7 +43,7 @@ class Pipeline implements ClientContextInterface
public function __construct(ClientInterface $client)
{
$this->client = $client;
$this->pipeline = new SplQueue();
$this->pipeline = new \SplQueue();
}
/**
@@ -126,11 +123,11 @@ class Pipeline implements ClientContextInterface
* from the current connection.
*
* @param ConnectionInterface $connection Current connection instance.
* @param SplQueue $commands Queued commands.
* @param \SplQueue $commands Queued commands.
*
* @return array
*/
protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
{
foreach ($commands as $command) {
$connection->writeRequest($command);
@@ -168,7 +165,7 @@ class Pipeline implements ClientContextInterface
$responses = $this->executePipeline($this->getConnection(), $this->pipeline);
$this->responses = array_merge($this->responses, $responses);
} else {
$this->pipeline = new SplQueue();
$this->pipeline = new \SplQueue();
}
return $this;
@@ -197,13 +194,13 @@ class Pipeline implements ClientContextInterface
*
* @return array
*
* @throws Exception
* @throws InvalidArgumentException
* @throws \Exception
* @throws \InvalidArgumentException
*/
public function execute($callable = null)
{
if ($callable && !is_callable($callable)) {
throw new InvalidArgumentException('The argument must be a callable object.');
throw new \InvalidArgumentException('The argument must be a callable object.');
}
$exception = null;
@@ -215,7 +212,7 @@ class Pipeline implements ClientContextInterface
}
$this->flushPipeline();
} catch (Exception $exception) {
} catch (\Exception $exception) {
// NOOP
}
+1 -3
View File
@@ -11,13 +11,11 @@
namespace Predis;
use Exception;
/**
* Base exception class for Predis-related errors.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
abstract class PredisException extends Exception
abstract class PredisException extends \Exception
{
}
+2 -4
View File
@@ -11,8 +11,6 @@
namespace Predis\Profile;
use InvalidArgumentException;
use ReflectionClass;
use Predis\ClientException;
/**
@@ -71,10 +69,10 @@ final class Factory
*/
public static function define($alias, $class)
{
$reflection = new ReflectionClass($class);
$reflection = new \ReflectionClass($class);
if (!$reflection->isSubclassOf('Predis\Profile\ProfileInterface')) {
throw new InvalidArgumentException("The class '$class' is not a valid profile class.");
throw new \InvalidArgumentException("The class '$class' is not a valid profile class.");
}
self::$profiles[$alias] = $class;
+2 -4
View File
@@ -11,8 +11,6 @@
namespace Predis\Profile;
use InvalidArgumentException;
use ReflectionClass;
use Predis\ClientException;
use Predis\Command\Processor\ProcessorInterface;
@@ -111,10 +109,10 @@ abstract class RedisProfile implements ProfileInterface
*/
public function defineCommand($commandID, $class)
{
$reflection = new ReflectionClass($class);
$reflection = new \ReflectionClass($class);
if (!$reflection->isSubclassOf('Predis\Command\CommandInterface')) {
throw new InvalidArgumentException("The class '$class' is not a valid command class.");
throw new \InvalidArgumentException("The class '$class' is not a valid command class.");
}
$this->commands[strtoupper($commandID)] = $class;
+1 -3
View File
@@ -11,14 +11,12 @@
namespace Predis\PubSub;
use Iterator;
/**
* Base implementation of a PUB/SUB consumer abstraction based on PHP iterators.
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
abstract class AbstractConsumer implements Iterator
abstract class AbstractConsumer implements \Iterator
{
const SUBSCRIBE = 'subscribe';
const UNSUBSCRIBE = 'unsubscribe';
+1 -3
View File
@@ -11,8 +11,6 @@
namespace Predis\PubSub;
use InvalidArgumentException;
/**
* Method-dispatcher loop built around the client-side abstraction of a Redis
* PUB / SUB context.
@@ -46,7 +44,7 @@ class DispatcherLoop
protected function assertCallback($callable)
{
if (!is_callable($callable)) {
throw new InvalidArgumentException('The given argument must be a callable object.');
throw new \InvalidArgumentException('The given argument must be a callable object.');
}
}
+1 -3
View File
@@ -11,8 +11,6 @@
namespace Predis\Response\Iterator;
use Iterator;
use Countable;
use Predis\Response\ResponseInterface;
/**
@@ -27,7 +25,7 @@ use Predis\Response\ResponseInterface;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
abstract class MultiBulkIterator implements Iterator, Countable, ResponseInterface
abstract class MultiBulkIterator implements \Iterator, \Countable, ResponseInterface
{
protected $current;
protected $position;
+3 -7
View File
@@ -11,10 +11,6 @@
namespace Predis\Response\Iterator;
use OuterIterator;
use InvalidArgumentException;
use UnexpectedValueException;
/**
* Outer iterator consuming streamable multibulk responses by yielding tuples of
* keys and values.
@@ -24,7 +20,7 @@ use UnexpectedValueException;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class MultiBulkTuple extends MultiBulk implements OuterIterator
class MultiBulkTuple extends MultiBulk implements \OuterIterator
{
private $iterator;
@@ -52,13 +48,13 @@ class MultiBulkTuple extends MultiBulk implements OuterIterator
protected function checkPreconditions(MultiBulk $iterator)
{
if ($iterator->getPosition() !== 0) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'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.');
throw new \UnexpectedValueException('Invalid response size for a tuple iterator.');
}
}
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Session;
use SessionHandlerInterface;
use Predis\ClientInterface;
/**
@@ -24,7 +23,7 @@ use Predis\ClientInterface;
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
class Handler implements SessionHandlerInterface
class Handler implements \SessionHandlerInterface
{
protected $client;
protected $ttl;
+4 -7
View File
@@ -11,9 +11,6 @@
namespace Predis\Transaction;
use Exception;
use InvalidArgumentException;
use SplQueue;
use Predis\ClientContextInterface;
use Predis\ClientException;
use Predis\ClientInterface;
@@ -115,7 +112,7 @@ class MultiExec implements ClientContextInterface
protected function reset()
{
$this->state->reset();
$this->commands = new SplQueue();
$this->commands = new \SplQueue();
}
/**
@@ -316,7 +313,7 @@ class MultiExec implements ClientContextInterface
*
* @param mixed $callable Callback for execution.
*
* @throws InvalidArgumentException
* @throws \InvalidArgumentException
* @throws ClientException
*/
private function checkBeforeExecution($callable)
@@ -329,7 +326,7 @@ class MultiExec implements ClientContextInterface
if ($callable) {
if (!is_callable($callable)) {
throw new InvalidArgumentException('The argument must be a callable object.');
throw new \InvalidArgumentException('The argument must be a callable object.');
}
if (!$this->commands->isEmpty()) {
@@ -436,7 +433,7 @@ class MultiExec implements ClientContextInterface
// NOOP
} catch (ServerException $exception) {
// NOOP
} catch (Exception $exception) {
} catch (\Exception $exception) {
$this->discard();
}
+3 -4
View File
@@ -11,7 +11,6 @@
namespace Predis;
use ReflectionProperty;
use PredisTestCase;
/**
@@ -688,7 +687,7 @@ class ClientTest extends PredisTestCase
$this->assertInstanceOf('Predis\PubSub\Consumer', $pubsub = $client->pubSubLoop($options));
$reflection = new ReflectionProperty($pubsub, 'options');
$reflection = new \ReflectionProperty($pubsub, 'options');
$reflection->setAccessible(true);
$this->assertSame($options, $reflection->getValue($pubsub));
@@ -741,11 +740,11 @@ class ClientTest extends PredisTestCase
$this->assertInstanceOf('Predis\Transaction\MultiExec', $tx = $client->transaction($options));
// I hate this part but reflection is the easiest way in this case.
$property = new ReflectionProperty($tx, 'modeCAS');
$property = new \ReflectionProperty($tx, 'modeCAS');
$property->setAccessible(true);
$this->assertSame($options['cas'], $property->getValue($tx));
$property = new ReflectionProperty($tx, 'attempts');
$property = new \ReflectionProperty($tx, 'attempts');
$property->setAccessible(true);
$this->assertSame($options['retry'], $property->getValue($tx));
}
@@ -11,8 +11,6 @@
namespace Predis\Configuration;
use InvalidArgumentException;
use stdClass;
use PredisTestCase;
/**
@@ -79,6 +77,6 @@ class ConnectionFactoryOptionTest extends PredisTestCase
$option = new ConnectionFactoryOption();
$options = $this->getMock('Predis\Configuration\OptionsInterface');
$option->filter($options, new stdClass());
$option->filter($options, new \stdClass());
}
}
@@ -11,7 +11,6 @@
namespace Predis\Configuration;
use stdClass;
use PredisTestCase;
/**
@@ -61,7 +60,7 @@ class ExceptionsOptionTest extends PredisTestCase
$option = new ExceptionsOption();
$options = $this->getMock('Predis\Configuration\OptionsInterface');
$this->assertFalse($option->filter($options, new stdClass()));
$this->assertFalse($option->filter($options, new \stdClass()));
$this->assertFalse($option->filter($options, 'invalid'));
}
}
+1 -2
View File
@@ -11,7 +11,6 @@
namespace Predis\Configuration;
use stdClass;
use PredisTestCase;
/**
@@ -161,7 +160,7 @@ class OptionsTest extends PredisTestCase
*/
public function testLazilyInitializesCustomOptionValueUsingObjectWithInvokeMagicMethod()
{
$custom = new stdClass();
$custom = new \stdClass();
// NOTE: closure values are covered by this test since they define __invoke().
$callable = $this->getMock('stdClass', array('__invoke'));
@@ -11,8 +11,6 @@
namespace Predis\Configuration;
use InvalidArgumentException;
use stdClass;
use PredisTestCase;
use Predis\Command\Processor\KeyPrefixProcessor;
use Predis\Profile;
@@ -147,7 +145,7 @@ class ProfileOptionTest extends PredisTestCase
$option = new ProfileOption();
$options = $this->getMock('Predis\Configuration\OptionsInterface');
$option->filter($options, new stdClass());
$option->filter($options, new \stdClass());
}
/**
+4 -6
View File
@@ -11,8 +11,6 @@
namespace Predis\Pipeline;
use Exception;
use InvalidArgumentException;
use PredisTestCase;
use Predis\Client;
use Predis\ClientException;
@@ -349,7 +347,7 @@ class PipelineTest extends PredisTestCase
$pipe->echo('two');
throw new ClientException('TEST');
});
} catch (Exception $exception) {
} catch (\Exception $exception) {
// NOOP
}
@@ -426,7 +424,7 @@ class PipelineTest extends PredisTestCase
$pipe->set('foo', 'bar');
throw new ClientException('TEST');
});
} catch (Exception $exception) {
} catch (\Exception $exception) {
// NOOP
}
@@ -452,7 +450,7 @@ class PipelineTest extends PredisTestCase
$pipe->lpush('foo', 'bar');
$pipe->set('hoge', 'piyo');
});
} catch (Exception $exception) {
} catch (\Exception $exception) {
// NOOP
}
@@ -507,7 +505,7 @@ class PipelineTest extends PredisTestCase
{
return function ($command) {
if (($id = $command->getId()) !== 'ECHO') {
throw new InvalidArgumentException("Expected ECHO, got {$id}");
throw new \InvalidArgumentException("Expected ECHO, got {$id}");
}
list($echoed) = $command->getArguments();