Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public function createCommand($commandID, $arguments = [])
}

/**
* @param $name
* @param $name
vladvildanov marked this conversation as resolved.
Show resolved Hide resolved
* @return ContainerInterface
*/
public function __get($name)
Expand All @@ -355,8 +355,8 @@ public function __get($name)
}

/**
* @param $name
* @param $value
* @param $name
* @param $value
vladvildanov marked this conversation as resolved.
Show resolved Hide resolved
* @return mixed
*/
public function __set($name, $value)
Expand All @@ -365,7 +365,7 @@ public function __set($name, $value)
}

/**
* @param $name
* @param $name
vladvildanov marked this conversation as resolved.
Show resolved Hide resolved
* @return mixed
*/
public function __isset($name)
Expand Down
4 changes: 2 additions & 2 deletions src/Command/Redis/Container/ContainerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ interface ContainerInterface
* Creates Redis container command with subcommand as virtual method name
* and sends a request to the server.
*
* @param $subcommandID
* @param $arguments
* @param $subcommandID
* @param $arguments
vladvildanov marked this conversation as resolved.
Show resolved Hide resolved
* @return mixed
*/
public function __call($subcommandID, $arguments);
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Redis/SORT.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public function setArguments(array $arguments)
}
}

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];
Expand Down
4 changes: 2 additions & 2 deletions src/Command/Traits/Keys.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function setArguments(array $arguments, bool $withNumkeys = true)
$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');
}
Expand Down
8 changes: 4 additions & 4 deletions src/Configuration/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public function getDefault($option)
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)
;
}

Expand All @@ -78,8 +78,8 @@ public function defined($option)
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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Connection/RelayMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function onFlushed(?callable $callback)
* @param string $pattern
* @return bool
*/
public function onInvalidated(?callable $callback, ?string $pattern = null)
public function onInvalidated(?callable $callback, string $pattern = null)
tillkruss marked this conversation as resolved.
Show resolved Hide resolved
{
return $this->client->onInvalidated($callback, $pattern);
}
Expand Down Expand Up @@ -129,7 +129,7 @@ public function maxMemory()
* @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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/PubSub/AbstractConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/OneOfConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected function matches($other): bool
}

/**
* @param $other
* @param $other
vladvildanov marked this conversation as resolved.
Show resolved Hide resolved
* @return string
*/
protected function failureDescription($other): string
Expand Down
19 changes: 9 additions & 10 deletions tests/PHPUnit/PredisTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
abstract class PredisTestCase extends \PHPUnit\Framework\TestCase
{
protected $redisServerVersion = null;
protected $redisServerVersion;
protected $redisJsonVersion;

/**
Expand Down Expand Up @@ -73,7 +73,7 @@ protected function sleep(float $seconds): void
*
* @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);
}
Expand Down Expand Up @@ -224,7 +224,7 @@ protected function getCommandFactory(): Command\Factory
*
* @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(),
Expand Down Expand Up @@ -300,7 +300,6 @@ protected function getMockConnectionOfType(string $interface, $parameters = null
* 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
Expand Down Expand Up @@ -362,9 +361,9 @@ protected function getRequiredRedisServerVersion(): ?string
$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];
}
Expand Down Expand Up @@ -517,9 +516,9 @@ protected function getRequiredModuleVersion(string $module): ?string
$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];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/RedisCommandConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion tests/Predis/Cluster/PredisStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ protected function getClusterStrategy(): StrategyInterface
*
* @return array
*/
protected function getExpectedCommands(?string $type = null): array
protected function getExpectedCommands(string $type = null): array
{
$commands = [
/* commands operating on the key space */
Expand Down
2 changes: 1 addition & 1 deletion tests/Predis/Cluster/RedisStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ protected function getClusterStrategy(): StrategyInterface
*
* @return array
*/
protected function getExpectedCommands(?string $type = null): array
protected function getExpectedCommands(string $type = null): array
{
$commands = [
/* commands operating on the key space */
Expand Down
8 changes: 4 additions & 4 deletions tests/Predis/Command/Redis/EVALSHA_RO_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public function testParseResponse(): void
/**
* @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
*/
Expand Down
10 changes: 5 additions & 5 deletions tests/Predis/Command/Redis/EVAL_RO_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public function testParseResponse(): void
/**
* @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
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/Predis/Command/Redis/FCALL_RO_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ protected function tearDown(): void
);

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);
Expand Down
6 changes: 3 additions & 3 deletions tests/Predis/Command/Redis/FCALL_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public function testParseResponse(): void
/**
* @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
*/
Expand Down
6 changes: 3 additions & 3 deletions tests/Predis/Command/Redis/LCS_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public function testParseResponse($actualResponse, $expectedResponse): void
/**
* @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
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/Predis/Command/Redis/ZINTERCARD_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public function testThrowsExceptionOnWrongType(): void
/**
* @group connected
* @dataProvider unexpectedValuesProvider
* @param $keys
* @param $limit
* @param $keys
* @param $limit
* @param string $expectedExceptionMessage
* @return void
* @requiresRedisVersion >= 7.0.0
Expand Down
6 changes: 3 additions & 3 deletions tests/Predis/Command/Redis/ZINTERSTORE_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ public function testThrowsExceptionOnWrongType(): void

/**
* @dataProvider unexpectedValueProvider
* @param string $destination
* @param $keys
* @param $weights
* @param string $destination
* @param $keys
* @param $weights
* @param string $aggregate
* @param string $expectedExceptionMessage
* @return void
Expand Down
4 changes: 2 additions & 2 deletions tests/Predis/Command/Redis/ZINTER_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public function testThrowsExceptionOnWrongType(): void

/**
* @dataProvider unexpectedValueProvider
* @param $keys
* @param $weights
* @param $keys
* @param $weights
* @param string $aggregate
* @param bool $withScores
* @param string $expectedExceptionMessage
Expand Down
16 changes: 8 additions & 8 deletions tests/Predis/Command/Redis/ZRANGESTORE_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public function testStoresSortedSetRanges(
/**
* @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
*/
Expand Down
6 changes: 3 additions & 3 deletions tests/Predis/Command/Redis/ZUNIONSTORE_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ public function testThrowsExceptionOnWrongType(): void

/**
* @dataProvider unexpectedValueProvider
* @param string $destination
* @param $keys
* @param $weights
* @param string $destination
* @param $keys
* @param $weights
* @param string $aggregate
* @param string $expectedExceptionMessage
* @return void
Expand Down
4 changes: 2 additions & 2 deletions tests/Predis/Command/Redis/ZUNION_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public function testThrowsExceptionOnWrongType(): void

/**
* @dataProvider unexpectedValueProvider
* @param $keys
* @param $weights
* @param $keys
* @param $weights
* @param string $aggregate
* @param bool $withScores
* @param string $expectedExceptionMessage
Expand Down
2 changes: 1 addition & 1 deletion tests/Predis/Replication/ReplicationStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public function testSetLuaScriptAsReadOperationWorksWithScriptCommandAndCallable
*
* @return array
*/
protected function getExpectedCommands(?string $type = null): array
protected function getExpectedCommands(string $type = null): array
{
$commands = [
/* commands operating on the connection */
Expand Down