mirror of
https://github.com/predis/predis.git
synced 2026-08-31 12:43:31 +00:00
Codestyle changes related to php-cs-fixer update (#1311)
* Codestyle changes * Added missing type-hints
This commit is contained in:
committed by
GitHub
parent
95c23fb94d
commit
3c322fc4e3
+7
-7
@@ -346,29 +346,29 @@ class Client implements ClientInterface, IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param string $name
|
||||
* @return ContainerInterface
|
||||
*/
|
||||
public function __get($name)
|
||||
public function __get(string $name)
|
||||
{
|
||||
return ContainerFactory::create($this, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function __set($name, $value)
|
||||
public function __set(string $name, $value)
|
||||
{
|
||||
throw new RuntimeException('Not allowed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function __isset($name)
|
||||
public function __isset(string $name)
|
||||
{
|
||||
throw new RuntimeException('Not allowed');
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ abstract class AbstractContainer implements ContainerInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __call($subcommandID, $arguments)
|
||||
public function __call(string $subcommandID, array $arguments)
|
||||
{
|
||||
array_unshift($arguments, strtoupper($subcommandID));
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ interface ContainerInterface
|
||||
* Creates Redis container command with subcommand as virtual method name
|
||||
* and sends a request to the server.
|
||||
*
|
||||
* @param $subcommandID
|
||||
* @param $arguments
|
||||
* @param string $subcommandID
|
||||
* @param array $arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($subcommandID, $arguments);
|
||||
public function __call(string $subcommandID, array $arguments);
|
||||
|
||||
/**
|
||||
* Returns containerCommandId of specific container command.
|
||||
|
||||
@@ -60,9 +60,9 @@ class SORT extends RedisCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($sortParams['LIMIT']) &&
|
||||
is_array($sortParams['LIMIT']) &&
|
||||
count($sortParams['LIMIT']) == 2) {
|
||||
if (isset($sortParams['LIMIT'])
|
||||
&& is_array($sortParams['LIMIT'])
|
||||
&& count($sortParams['LIMIT']) == 2) {
|
||||
$query[] = 'LIMIT';
|
||||
$query[] = $sortParams['LIMIT'][0];
|
||||
$query[] = $sortParams['LIMIT'][1];
|
||||
|
||||
@@ -25,8 +25,8 @@ trait Keys
|
||||
$argumentsLength = count($arguments);
|
||||
|
||||
if (
|
||||
static::$keysArgumentPositionOffset > $argumentsLength ||
|
||||
!is_array($arguments[static::$keysArgumentPositionOffset])
|
||||
static::$keysArgumentPositionOffset > $argumentsLength
|
||||
|| !is_array($arguments[static::$keysArgumentPositionOffset])
|
||||
) {
|
||||
throw new UnexpectedValueException('Wrong keys argument type or position offset');
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ class Options implements OptionsInterface
|
||||
public function defined($option)
|
||||
{
|
||||
return
|
||||
array_key_exists($option, $this->options) ||
|
||||
array_key_exists($option, $this->input)
|
||||
array_key_exists($option, $this->options)
|
||||
|| array_key_exists($option, $this->input)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ class Options implements OptionsInterface
|
||||
public function __isset($option)
|
||||
{
|
||||
return (
|
||||
array_key_exists($option, $this->options) ||
|
||||
array_key_exists($option, $this->input)
|
||||
array_key_exists($option, $this->options)
|
||||
|| array_key_exists($option, $this->input)
|
||||
) && $this->__get($option) !== null;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ trait RelayMethods
|
||||
* @param string $pattern
|
||||
* @return bool
|
||||
*/
|
||||
public function onInvalidated(?callable $callback, ?string $pattern = null)
|
||||
public function onInvalidated(?callable $callback, string $pattern = null)
|
||||
{
|
||||
return $this->client->onInvalidated($callback, $pattern);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ trait RelayMethods
|
||||
* @param ?int $db
|
||||
* @return bool
|
||||
*/
|
||||
public function flushMemory(?string $endpointId = null, int $db = null)
|
||||
public function flushMemory(string $endpointId = null, int $db = null)
|
||||
{
|
||||
return $this->client->flushMemory($endpointId, $db);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ abstract class AbstractConsumer implements Iterator
|
||||
public const STATUS_SUBSCRIBED = 2; // 0b0010
|
||||
public const STATUS_PSUBSCRIBED = 4; // 0b0100
|
||||
|
||||
protected $position = null;
|
||||
protected $position;
|
||||
protected $statusFlags = self::STATUS_VALID;
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ class OneOfConstraint extends Constraint
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $other
|
||||
* @param mixed $other
|
||||
* @return string
|
||||
*/
|
||||
protected function failureDescription($other): string
|
||||
|
||||
@@ -22,7 +22,7 @@ use Predis\Connection;
|
||||
*/
|
||||
abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $redisServerVersion = null;
|
||||
protected $redisServerVersion;
|
||||
protected $redisJsonVersion;
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
|
||||
*
|
||||
* @return RedisCommandConstraint
|
||||
*/
|
||||
public function isRedisCommand($command = null, ?array $arguments = null): RedisCommandConstraint
|
||||
public function isRedisCommand($command = null, array $arguments = null): RedisCommandConstraint
|
||||
{
|
||||
return new RedisCommandConstraint($command, $arguments);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
|
||||
*
|
||||
* @return Client
|
||||
*/
|
||||
protected function createClient(?array $parameters = null, ?array $options = null, ?bool $flushdb = true): Client
|
||||
protected function createClient(array $parameters = null, array $options = null, ?bool $flushdb = true): Client
|
||||
{
|
||||
$parameters = array_merge(
|
||||
$this->getDefaultParametersArray(),
|
||||
@@ -300,7 +300,6 @@ abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
|
||||
* the default connection parameters used by Predis or a set of connection
|
||||
* parameters specified in the optional second argument.
|
||||
*
|
||||
|
||||
* @param array|string|null $parameters Optional connection parameters
|
||||
*
|
||||
* @return MockObject|Connection\NodeConnectionInterface
|
||||
@@ -362,9 +361,9 @@ abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
|
||||
$this->getName(false)
|
||||
);
|
||||
|
||||
if (isset($annotations['method']['requiresRedisVersion'], $annotations['method']['group']) &&
|
||||
!empty($annotations['method']['requiresRedisVersion']) &&
|
||||
in_array('connected', $annotations['method']['group'])
|
||||
if (isset($annotations['method']['requiresRedisVersion'], $annotations['method']['group'])
|
||||
&& !empty($annotations['method']['requiresRedisVersion'])
|
||||
&& in_array('connected', $annotations['method']['group'])
|
||||
) {
|
||||
return $annotations['method']['requiresRedisVersion'][0];
|
||||
}
|
||||
@@ -517,9 +516,9 @@ abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
|
||||
$this->getName(false)
|
||||
);
|
||||
|
||||
if (isset($annotations['method'][$moduleAnnotation], $annotations['method']['group']) &&
|
||||
!empty($annotations['method'][$moduleAnnotation]) &&
|
||||
in_array('connected', $annotations['method']['group'], true)
|
||||
if (isset($annotations['method'][$moduleAnnotation], $annotations['method']['group'])
|
||||
&& !empty($annotations['method'][$moduleAnnotation])
|
||||
&& in_array('connected', $annotations['method']['group'], true)
|
||||
) {
|
||||
return $annotations['method'][$moduleAnnotation][0];
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class RedisCommandConstraint extends \PHPUnit\Framework\Constraint\Constraint
|
||||
* @param string|CommandInterface $command Expected command instance or command ID
|
||||
* @param ?array $arguments Expected command arguments
|
||||
*/
|
||||
public function __construct($command, ?array $arguments = null)
|
||||
public function __construct($command, array $arguments = null)
|
||||
{
|
||||
if ($command instanceof CommandInterface) {
|
||||
$this->commandID = strtoupper($command->getId());
|
||||
|
||||
@@ -310,7 +310,7 @@ class PredisStrategyTest extends PredisTestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getExpectedCommands(?string $type = null): array
|
||||
protected function getExpectedCommands(string $type = null): array
|
||||
{
|
||||
$commands = [
|
||||
/* commands operating on the key space */
|
||||
|
||||
@@ -333,7 +333,7 @@ class RedisStrategyTest extends PredisTestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getExpectedCommands(?string $type = null): array
|
||||
protected function getExpectedCommands(string $type = null): array
|
||||
{
|
||||
$commands = [
|
||||
/* commands operating on the key space */
|
||||
|
||||
@@ -61,10 +61,10 @@ class EVALSHA_RO_Test extends PredisCommandTestCase
|
||||
/**
|
||||
* @group connected
|
||||
* @dataProvider scriptsProvider
|
||||
* @param string $script
|
||||
* @param array $keys
|
||||
* @param array $arguments
|
||||
* @param $expectedResponse
|
||||
* @param string $script
|
||||
* @param array $keys
|
||||
* @param array $arguments
|
||||
* @param $expectedResponse
|
||||
* @return void
|
||||
* @requiresRedisVersion >= 7.0.0
|
||||
*/
|
||||
|
||||
@@ -61,11 +61,11 @@ class EVAL_RO_Test extends PredisCommandTestCase
|
||||
/**
|
||||
* @group connected
|
||||
* @dataProvider scriptsProvider
|
||||
* @param array $dictionary
|
||||
* @param string $script
|
||||
* @param array $keys
|
||||
* @param array $arguments
|
||||
* @param $expectedResponse
|
||||
* @param array $dictionary
|
||||
* @param string $script
|
||||
* @param array $keys
|
||||
* @param array $arguments
|
||||
* @param $expectedResponse
|
||||
* @return void
|
||||
* @requiresRedisVersion >= 7.0.0
|
||||
*/
|
||||
|
||||
@@ -113,8 +113,8 @@ class FCALL_RO_Test extends PredisCommandTestCase
|
||||
);
|
||||
|
||||
if (
|
||||
isset($annotations['method']['group']) &&
|
||||
in_array('connected', $annotations['method']['group'], true)
|
||||
isset($annotations['method']['group'])
|
||||
&& in_array('connected', $annotations['method']['group'], true)
|
||||
) {
|
||||
$redis = $this->getClient();
|
||||
$redis->function->delete(self::LIB_NAME);
|
||||
|
||||
@@ -60,9 +60,9 @@ class FCALL_Test extends PredisCommandTestCase
|
||||
/**
|
||||
* @group connected
|
||||
* @dataProvider functionsProvider
|
||||
* @param string $function
|
||||
* @param array $functionArguments
|
||||
* @param $expectedResponse
|
||||
* @param string $function
|
||||
* @param array $functionArguments
|
||||
* @param $expectedResponse
|
||||
* @return void
|
||||
* @requiresRedisVersion >= 7.0.0
|
||||
*/
|
||||
|
||||
@@ -58,9 +58,9 @@ class LCS_Test extends PredisCommandTestCase
|
||||
/**
|
||||
* @group connected
|
||||
* @dataProvider stringsProvider
|
||||
* @param array $stringsArguments
|
||||
* @param array $functionArguments
|
||||
* @param $expectedResponse
|
||||
* @param array $stringsArguments
|
||||
* @param array $functionArguments
|
||||
* @param $expectedResponse
|
||||
* @return void
|
||||
* @requiresRedisVersion >= 7.0.0
|
||||
*/
|
||||
|
||||
@@ -110,8 +110,8 @@ class ZINTERCARD_Test extends PredisCommandTestCase
|
||||
/**
|
||||
* @group connected
|
||||
* @dataProvider unexpectedValuesProvider
|
||||
* @param $keys
|
||||
* @param $limit
|
||||
* @param $keys
|
||||
* @param $limit
|
||||
* @param string $expectedExceptionMessage
|
||||
* @return void
|
||||
* @requiresRedisVersion >= 7.0.0
|
||||
|
||||
@@ -115,9 +115,9 @@ class ZINTERSTORE_Test extends PredisCommandTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider unexpectedValueProvider
|
||||
* @param string $destination
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param string $destination
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param string $aggregate
|
||||
* @param string $expectedExceptionMessage
|
||||
* @return void
|
||||
|
||||
@@ -127,8 +127,8 @@ class ZINTER_Test extends PredisCommandTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider unexpectedValueProvider
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param string $aggregate
|
||||
* @param bool $withScores
|
||||
* @param string $expectedExceptionMessage
|
||||
|
||||
@@ -102,14 +102,14 @@ class ZRANGESTORE_Test extends PredisCommandTestCase
|
||||
/**
|
||||
* @group connected
|
||||
* @dataProvider unexpectedValuesProvider
|
||||
* @param int|string $min
|
||||
* @param int|string $max
|
||||
* @param string|bool $by
|
||||
* @param $rev
|
||||
* @param $limit
|
||||
* @param int $offset
|
||||
* @param int $count
|
||||
* @param string $expectedExceptionMessage
|
||||
* @param int|string $min
|
||||
* @param int|string $max
|
||||
* @param string|bool $by
|
||||
* @param $rev
|
||||
* @param $limit
|
||||
* @param int $offset
|
||||
* @param int $count
|
||||
* @param string $expectedExceptionMessage
|
||||
* @return void
|
||||
* @requiresRedisVersion >= 6.2.0
|
||||
*/
|
||||
|
||||
@@ -115,9 +115,9 @@ class ZUNIONSTORE_Test extends PredisCommandTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider unexpectedValueProvider
|
||||
* @param string $destination
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param string $destination
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param string $aggregate
|
||||
* @param string $expectedExceptionMessage
|
||||
* @return void
|
||||
|
||||
@@ -101,8 +101,8 @@ class ZUNION_Test extends PredisCommandTestCase
|
||||
|
||||
/**
|
||||
* @dataProvider unexpectedValueProvider
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param $keys
|
||||
* @param $weights
|
||||
* @param string $aggregate
|
||||
* @param bool $withScores
|
||||
* @param string $expectedExceptionMessage
|
||||
|
||||
@@ -390,7 +390,7 @@ class ReplicationStrategyTest extends PredisTestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getExpectedCommands(?string $type = null): array
|
||||
protected function getExpectedCommands(string $type = null): array
|
||||
{
|
||||
$commands = [
|
||||
/* commands operating on the connection */
|
||||
|
||||
Reference in New Issue
Block a user