Removed static from callables because it's deprecated since PHP 8.2 (#1642)

This commit is contained in:
Thomas Stägemann
2026-02-20 10:05:12 +01:00
committed by GitHub
parent dd0713b515
commit 7fd23dbcb9
7 changed files with 13 additions and 9 deletions
+4
View File
@@ -6,6 +6,10 @@
### Added
- Make HTTL and HPTTL commands Prefixable (#1639)
## v3.4.1 (2026-02-11)
### Fixed
- Removed static from callables because it is deprecated since PHP 8.2
## v3.4.0 (2026-02-11)
### Added
- Added optional retry support (#1616)
+1 -1
View File
@@ -664,7 +664,7 @@ $client = new Predis\Client(['read_write_timeout' => 0, 'protocol' => 3]);
// Create push notifications consumer.
// Provides callback where current consumer subscribes to few channels before
// enter the loop.
$push = $client->push(static function (ClientInterface $client) {
$push = $client->push(function (ClientInterface $client) {
$response = $client->subscribe('channel', 'control');
$status = ($response[2] === 1) ? 'OK' : 'FAILED';
echo "Channel subscription status: {$status}\n";
+1 -1
View File
@@ -19,7 +19,7 @@ require __DIR__ . '/shared.php';
$client = new Predis\Client($single_server + ['read_write_timeout' => 0, 'protocol' => 3]);
// 2. Create push notifications consumer. Provides callback where current consumer subscribes to few channels before enter the loop.
$push = $client->push(static function (ClientInterface $client) {
$push = $client->push(function (ClientInterface $client) {
$response = $client->subscribe('channel', 'control');
$status = ($response[2] === 1) ? 'OK' : 'FAILED';
echo "Channel subscription status: {$status}\n";
+1 -1
View File
@@ -21,7 +21,7 @@ require __DIR__ . '/shared.php';
$client = new Predis\Client($single_server + ['read_write_timeout' => 0, 'protocol' => 3]);
// 2. Create push notifications consumer. Provides callback where current consumer subscribes to few channels before enter the loop.
$push = $client->push(static function (ClientInterface $client) {
$push = $client->push(function (ClientInterface $client) {
$response = $client->subscribe('channel', 'control');
$status = ($response[2] === 1) ? 'OK' : 'FAILED';
echo "Channel subscription status: {$status}\n";
+1 -1
View File
@@ -33,7 +33,7 @@ abstract class PrefixableCommand extends Command implements PrefixableCommandInt
public function applyPrefixForAllArguments(string $prefix): void
{
$this->setRawArguments(
array_map(static function ($key) use ($prefix) {
array_map(function ($key) use ($prefix) {
return $prefix . $key;
}, $this->getArguments())
);
+2 -2
View File
@@ -69,12 +69,12 @@ class XINFO extends RedisCommand
}
if (isset($result['groups']) && is_array($result['groups'])) {
$result['groups'] = array_map(static function ($group) {
$result['groups'] = array_map(function ($group) {
if ($group === array_values($group)) {
$group = CommandUtility::arrayToDictionary($group, null, false);
}
if (isset($group['consumers'])) {
$group['consumers'] = array_map(static function ($consumer) {
$group['consumers'] = array_map(function ($consumer) {
if ($consumer === array_values($consumer)) {
$consumer = CommandUtility::arrayToDictionary($consumer, null, false);
}
+3 -3
View File
@@ -352,7 +352,7 @@ abstract class PredisTestCase extends PHPUnit\Framework\TestCase
if ($isSSL && $isCluster) {
// For cluster SSL tests, use non-SSL cluster endpoints
$endpoints = explode(',', constant('REDIS_CLUSTER_ENDPOINTS'));
$parameters = array_map(static function (string $elem) {
$parameters = array_map(function (string $elem) {
return 'tcp://' . $elem;
}, $endpoints);
} elseif ($isSSL) {
@@ -792,7 +792,7 @@ abstract class PredisTestCase extends PHPUnit\Framework\TestCase
);
$scheme = $this->isSSLTest() ? 'tls' : 'tcp';
return array_map(static function (string $elem) use ($scheme) {
return array_map(function (string $elem) use ($scheme) {
return "{$scheme}://" . $elem;
}, $endpoints);
}
@@ -806,7 +806,7 @@ abstract class PredisTestCase extends PHPUnit\Framework\TestCase
{
$endpoints = explode(',', constant('REDIS_SENTINEL_ENDPOINTS'));
return array_map(static function (string $elem) {
return array_map(function (string $elem) {
return "tcp://{$elem}";
}, $endpoints);
}