Minor code styling and phpdoc changes.

This commit is contained in:
Daniele Alessandri
2014-07-28 12:04:07 +02:00
parent 5c02e4e47b
commit df653a7c00
21 changed files with 34 additions and 65 deletions
+2 -4
View File
@@ -477,7 +477,7 @@ class Client implements ClientInterface
*
* @param mixed ... Array of options, a callable for execution, or both.
*
* @return PubSubConsumer|NULL
* @return PubSubConsumer|null
*/
public function pubSubLoop(/* arguments */)
{
@@ -490,7 +490,7 @@ class Client implements ClientInterface
* @param array $options Options for the context.
* @param mixed $callable Optional callable used to execute the context.
*
* @return PubSubConsumer|NULL
* @return PubSubConsumer|null
*/
protected function createPubSub(array $options = null, $callable = null)
{
@@ -505,8 +505,6 @@ class Client implements ClientInterface
$pubsub->stop();
}
}
return null;
}
/**
+6 -18
View File
@@ -225,7 +225,7 @@ abstract class ClusterStrategy implements StrategyInterface
*
* @param CommandInterface $command Command instance.
*
* @return string
* @return string|null
*/
protected function getKeyFromAllArguments(CommandInterface $command)
{
@@ -234,8 +234,6 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys($arguments)) {
return $arguments[0];
}
return null;
}
/**
@@ -244,7 +242,7 @@ abstract class ClusterStrategy implements StrategyInterface
*
* @param CommandInterface $command Command instance.
*
* @return string
* @return string|null
*/
protected function getKeyFromInterleavedArguments(CommandInterface $command)
{
@@ -258,8 +256,6 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys($keys)) {
return $arguments[0];
}
return null;
}
/**
@@ -267,7 +263,7 @@ abstract class ClusterStrategy implements StrategyInterface
*
* @param CommandInterface $command Command instance.
*
* @return string
* @return string|null
*/
protected function getKeyFromBlockingListCommands(CommandInterface $command)
{
@@ -276,8 +272,6 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys(array_slice($arguments, 0, count($arguments) - 1))) {
return $arguments[0];
}
return null;
}
/**
@@ -285,7 +279,7 @@ abstract class ClusterStrategy implements StrategyInterface
*
* @param CommandInterface $command Command instance.
*
* @return string
* @return string|null
*/
protected function getKeyFromBitOp(CommandInterface $command)
{
@@ -294,8 +288,6 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys(array_slice($arguments, 1, count($arguments)))) {
return $arguments[1];
}
return null;
}
/**
@@ -303,7 +295,7 @@ abstract class ClusterStrategy implements StrategyInterface
*
* @param CommandInterface $command Command instance.
*
* @return string
* @return string|null
*/
protected function getKeyFromZsetAggregationCommands(CommandInterface $command)
{
@@ -313,8 +305,6 @@ abstract class ClusterStrategy implements StrategyInterface
if ($this->checkSameSlotForKeys($keys)) {
return $arguments[0];
}
return null;
}
/**
@@ -322,7 +312,7 @@ abstract class ClusterStrategy implements StrategyInterface
*
* @param CommandInterface $command Command instance.
*
* @return string
* @return string|null
*/
protected function getKeyFromScriptingCommands(CommandInterface $command)
{
@@ -335,8 +325,6 @@ abstract class ClusterStrategy implements StrategyInterface
if ($keys && $this->checkSameSlotForKeys($keys)) {
return $keys[0];
}
return null;
}
/**
@@ -51,7 +51,7 @@ interface DistributorInterface
*
* @param mixed $slot
*
* @return mixed
* @return mixed|null
*/
public function getBySlot($slot);
-2
View File
@@ -204,8 +204,6 @@ class HashRing implements DistributorInterface, HashGeneratorInterface
if (isset($this->ring[$slot])) {
return $this->ring[$slot];
}
return null;
}
/**
-4
View File
@@ -67,8 +67,6 @@ abstract class Command implements CommandInterface
if (isset($this->arguments[$index])) {
return $this->arguments[$index];
}
return null;
}
/**
@@ -87,8 +85,6 @@ abstract class Command implements CommandInterface
if (isset($this->slot)) {
return $this->slot;
}
return null;
}
/**
+2 -2
View File
@@ -36,7 +36,7 @@ interface CommandInterface
/**
* Returns the assigned slot of the command for clustering distribution.
*
* @return int
* @return int|null
*/
public function getSlot();
@@ -66,7 +66,7 @@ interface CommandInterface
*
* @param int $index Index of the desired argument.
*
* @return mixed
* @return mixed|null
*/
public function getArgument($index);
-4
View File
@@ -101,8 +101,6 @@ class RawCommand implements CommandInterface
if (isset($this->arguments[$index])) {
return $this->arguments[$index];
}
return null;
}
/**
@@ -121,8 +119,6 @@ class RawCommand implements CommandInterface
if (isset($this->slot)) {
return $this->slot;
}
return null;
}
/**
+3 -3
View File
@@ -31,7 +31,7 @@ class ClusterOption implements OptionInterface
* @param OptionsInterface $options Instance of the client options.
* @param string $id Descriptive identifier of the cluster type (`predis`, `redis-cluster`)
*
* @return ClusterInterface
* @return ClusterInterface|null
*/
protected function createByDescription(OptionsInterface $options, $id)
{
@@ -44,9 +44,9 @@ class ClusterOption implements OptionInterface
case 'redis-cluster':
return new RedisCluster($options->connections);
default:
return;
}
return null;
}
/**
-2
View File
@@ -63,8 +63,6 @@ class Options implements OptionsInterface
return $handler->getDefault($this);
}
return null;
}
/**
+2 -2
View File
@@ -31,7 +31,7 @@ interface OptionsInterface
*
* @param string $option Name of the option.
*
* @return mixed
* @return mixed|null
*/
public function getDefault($option);
@@ -58,7 +58,7 @@ interface OptionsInterface
*
* @param string $option Name of the option.
*
* @return mixed
* @return mixed|null
*/
public function __get($option);
}
+1 -5
View File
@@ -345,22 +345,18 @@ class RedisCluster implements ClusterInterface, IteratorAggregate, Countable
if (isset($this->pool[$connectionID])) {
return $this->pool[$connectionID];
}
return null;
}
/**
* Returns a random connection from the pool.
*
* @return NodeConnectionInterface
* @return NodeConnectionInterface|null
*/
protected function getRandomConnection()
{
if ($this->pool) {
return $this->pool[array_rand($this->pool)];
}
return null;
}
/**
@@ -51,7 +51,7 @@ interface AggregateConnectionInterface extends ConnectionInterface
*
* @param string $connectionID Connection alias.
*
* @return NodeConnectionInterface
* @return NodeConnectionInterface|null
*/
public function getConnectionById($connectionID);
}
-2
View File
@@ -114,8 +114,6 @@ class Parameters implements ParametersInterface
if (isset($this->parameters[$parameter])) {
return $this->parameters[$parameter];
}
return null;
}
/**
+1 -1
View File
@@ -49,7 +49,7 @@ interface ParametersInterface
*
* @param string $parameter Name of the parameter.
*
* @return mixed
* @return mixed|null
*/
public function __get($parameter);
+2 -2
View File
@@ -365,9 +365,9 @@ class PhpiredisSocketConnection extends AbstractConnection
return phpiredis_reader_get_reply($reader);
} else {
$this->onProtocolError(phpiredis_reader_get_error($reader));
}
return null;
return;
}
}
/**
+2 -2
View File
@@ -200,9 +200,9 @@ class PhpiredisStreamConnection extends StreamConnection
return phpiredis_reader_get_reply($reader);
} else {
$this->onProtocolError(phpiredis_reader_get_error($reader));
}
return null;
return;
}
}
/**
+2 -2
View File
@@ -239,9 +239,9 @@ class StreamConnection extends AbstractConnection
default:
$this->onProtocolError("Unknown response prefix: '$prefix'.");
}
return null;
return;
}
}
/**
+1 -3
View File
@@ -70,15 +70,13 @@ abstract class RedisProfile implements ProfileInterface
*
* @param string $commandID Command ID.
*
* @return string
* @return string|null
*/
public function getCommandClass($commandID)
{
if (isset($this->commands[$commandID = strtoupper($commandID)])) {
return $this->commands[$commandID];
}
return null;
}
/**
+5 -2
View File
@@ -45,7 +45,10 @@ class BulkResponse implements ResponseHandlerInterface
return null;
}
// TODO: we should probably check if < -1, just to make sure.
return null;
CommunicationException::handle(new ProtocolException(
$connection, "Value '$payload' is not a valid length for a bulk response."
));
return;
}
}
+1 -1
View File
@@ -99,7 +99,7 @@ class ProtocolProcessor implements ProtocolProcessorInterface
$connection, "Unknown response prefix: '$prefix'."
));
return null;
return;
}
}
+2 -2
View File
@@ -94,9 +94,9 @@ class ResponseReader implements ResponseReaderInterface
$this->onProtocolError($connection, "Unknown response prefix: '$prefix'.");
}
$handler = $this->handlers[$prefix];
$payload = $this->handlers[$prefix]->handle($connection, substr($header, 1));
return $handler->handle($connection, substr($header, 1));
return $payload;
}
/**