Skip to content

Commit

Permalink
Upgrade Predis suggestion to 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolim4 committed Jan 7, 2024
1 parent 4092267 commit aa786d0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
build:
dependencies:
override:
- "composer require -W --ignore-platform-reqs phpfastcache/phpssdb:~1.1 predis/predis:~1.1 aws/aws-sdk-php:~3.2 google/cloud-firestore:~1.20 solarium/solarium:~6.1"
- "composer require -W --ignore-platform-reqs phpfastcache/phpssdb:^1.2 predis/predis:^2.0"
nodes:
analysis:
project_setup:
Expand Down
2 changes: 1 addition & 1 deletion bin/ci/scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
composer self-update
composer validate
composer install
composer require -W phpfastcache/phpssdb:~1.2 predis/predis:~1.1
composer require -W phpfastcache/phpssdb:^1.2 predis/predis:^2.0
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"ext-wincache": "*",
"ext-leveldb": "*",
"ext-couchbase": "^3.0",
"predis/predis": "^1.1",
"predis/predis": "^2.0",
"phpfastcache/phpssdb": "~1.1.0",
"phpfastcache/arangodb-extension": "^9.2",
"phpfastcache/couchbasev4-extension": "^9.2",
Expand Down
9 changes: 5 additions & 4 deletions lib/Phpfastcache/Drivers/Predis/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function getHelp(): string
public function getStats(): DriverStatistic
{
$info = $this->instance->info();
$size = (isset($info['Memory']['used_memory']) ? $info['Memory']['used_memory'] : 0);
$version = (isset($info['Server']['redis_version']) ? $info['Server']['redis_version'] : 0);
$size = ($info['Memory']['used_memory'] ?? 0);
$version = ($info['Server']['redis_version'] ?? 0);
$date = (isset($info['Server']['uptime_in_seconds']) ? (new DateTime())->setTimestamp(time() - $info['Server']['uptime_in_seconds']) : 'unknown date');

return (new DriverStatistic())
Expand All @@ -78,8 +78,9 @@ public function getStats(): DriverStatistic
->setSize((int)$size)
->setInfo(
sprintf(
"The Redis daemon v%s is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.",
"The Redis daemon v%s (with Predis v%s) is up since %s.\n For more information see RawData. \n Driver size includes the memory allocation size.",
$version,
PredisClient::VERSION,
$date->format(DATE_RFC2822)
)
);
Expand All @@ -93,7 +94,7 @@ public function getStats(): DriverStatistic
protected function driverConnect(): bool
{
/**
* In case of an user-provided
* In case of a user-provided
* Predis client just return here
*/
if ($this->getConfig()->getPredisClient() instanceof PredisClient) {
Expand Down
6 changes: 2 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ parameters:
- '#PHPDoc tag @(.*)#'
# Phpstan is not able to know the magic of Ssdb __call() implementation
- '#Call to an undefined method phpssdb(.*)#'

# Phpstan not differencing couchbase and couchbase_v3 stubs from jetbrains/phpstorm-stubs
-
message: '#(Method|Class) Couchbase(.*)#'
path: lib/Phpfastcache/Drivers/Couchbasev3/Driver.php
# Issue in predis/predis => https://github.com/predis/predis/pull/710
-
message: '#Cannot call method getPayload\(\) on int#'
path: lib/Phpfastcache/Drivers/Predis/Driver.php

# See https://github.com/phpstan/phpstan/issues/10315
-
message: '#Dead catch - Phpfastcache\\Exceptions\\PhpfastcacheUnsupportedMethodException is never thrown in the try block.#'
Expand Down

0 comments on commit aa786d0

Please sign in to comment.