Skip to content

Update phpstan docs #45

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
vendor/
composer.lock
/*.rdb

###> squizlabs/php_codesniffer ###
/.phpcs-cache
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/RedisExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RedisExtension extends ConfigurableExtension
/**
* loadInternal.
*
* @param mixed[] $configs
* @param array{clients: array<string, array<mixed>>} $configs
* @param ContainerBuilder $container
*/
protected function loadInternal(array $configs, ContainerBuilder $container): void
Expand Down
17 changes: 11 additions & 6 deletions Redis/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,33 @@ public function __construct($parameters = null, $options = null)
*/
public function pop(string $key): ?string
{
return $this->call('lpop', [$key]);
$result = $this->call('lpop', [$key]);

return null === $result ? null : (string) $result;
}

/**
* {@inheritdoc}
*/
public function push(string $key, ...$values): int
{
return $this->call('rpush', array_merge([$key], $values));
return (int) $this->call('rpush', array_merge([$key], $values));
}

/**
* {@inheritdoc}
*/
public function count(string $key): int
{
return $this->call('llen', [$key]);
return (int) $this->call('llen', [$key]);
}

/**
* {@inheritdoc}
*/
public function remove(string $key): int
{
return $this->call('del', [$key]);
return (int) $this->call('del', [$key]);
}

/**
Expand All @@ -54,10 +56,13 @@ public function remove(string $key): int
* @param string $command the command ID
* @param mixed[] $arguments the arguments for the command
*
* @return mixed
* @return int|bool|string|float|null
*/
protected function call(string $command, array $arguments = [])
{
return $this->executeCommand($this->createCommand($command, $arguments));
/** @var int|bool|string|float|null $result */
$result = $this->executeCommand($this->createCommand($command, $arguments));

return $result;
}
}
1 change: 1 addition & 0 deletions Tests/Fixtures/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function getLogDir(): string

public function registerContainerConfiguration(LoaderInterface $loader): void
{
// @phpstan-ignore-next-line
if (Kernel::VERSION_ID < 53000) {
$loader->load($this->getRootDir() . '/config/config_test.yml');

Expand Down
5 changes: 4 additions & 1 deletion Tests/Redis/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SymfonyBundles\RedisBundle\Tests\Redis;

use Exception;
use Predis\Response\Status;
use SymfonyBundles\RedisBundle\Tests\TestCase;
use SymfonyBundles\RedisBundle\Redis\ClientInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -56,7 +57,9 @@ public function testSingleConnection(): void
],
]);

$this->assertSame('OK', $client->flushall()->getPayload());
$result = $client->flushall();
$this->assertInstanceOf(Status::class, $result);
$this->assertSame('OK', $result->getPayload());
}

/**
Expand Down
4 changes: 0 additions & 4 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@ parameters:
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 1
path: DependencyInjection/Configuration.php
-
message: '#^Comparison operation "<" between 70103 and 53000 is always false.$#'
count: 1
path: Tests/Fixtures/app/AppKernel.php
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ includes:
- phpstan-baseline.neon

parameters:
level: 8
level: max
paths:
- DependencyInjection/
- Redis/
Expand Down
Loading