Codestyle changes related to php-cs-fixer update (#1311)

* Codestyle changes

* Added missing type-hints
This commit is contained in:
Vladyslav Vildanov
2023-06-07 17:05:36 +03:00
committed by GitHub
parent 95c23fb94d
commit 3c322fc4e3
25 changed files with 74 additions and 75 deletions
+7 -7
View File
@@ -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.
+3 -3
View File
@@ -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];
+2 -2
View File
@@ -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');
}
+4 -4
View File
@@ -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;
}
+2 -2
View File
@@ -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);
}
+1 -1
View File
@@ -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;
/**
+1 -1
View File
@@ -44,7 +44,7 @@ class OneOfConstraint extends Constraint
}
/**
* @param $other
* @param mixed $other
* @return string
*/
protected function failureDescription($other): string
+9 -10
View File
@@ -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];
}
+1 -1
View File
@@ -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());
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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
*/
+5 -5
View File
@@ -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
*/
+2 -2
View File
@@ -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);
+3 -3
View File
@@ -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
*/
+3 -3
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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 */