N°8910 - Upgrade Symfony packages

This commit is contained in:
Benjamin Dalsass
2026-02-19 09:18:56 +01:00
committed by GitHub
parent d5706fcbef
commit d2f67dcb3c
126 changed files with 1107 additions and 2067 deletions

View File

@@ -86,7 +86,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
*
* Using ApcuAdapter makes system caches compatible with read-only filesystems.
*/
public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null): AdapterInterface
public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, ?LoggerInterface $logger = null): AdapterInterface
{
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true);
if (null !== $logger) {

View File

@@ -25,7 +25,7 @@ class ApcuAdapter extends AbstractAdapter
/**
* @throws CacheException if APCu is not enabled
*/
public function __construct(string $namespace = '', int $defaultLifetime = 0, string $version = null, MarshallerInterface $marshaller = null)
public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $version = null, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('APCu is not enabled.');

View File

@@ -74,7 +74,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
);
}
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
$item = $this->getItem($key);
$metadata = $item->getMetadata();

View File

@@ -88,7 +88,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
);
}
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
$doSave = true;
$callback = static function (CacheItem $item, bool &$save) use ($callback, &$doSave) {
@@ -98,7 +98,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
return $value;
};
$wrap = function (CacheItem $item = null, bool &$save = true) use ($key, $callback, $beta, &$wrap, &$doSave, &$metadata) {
$wrap = function (?CacheItem $item = null, bool &$save = true) use ($key, $callback, $beta, &$wrap, &$doSave, &$metadata) {
static $lastItem;
static $i = 0;
$adapter = $this->adapters[$i];

View File

@@ -39,7 +39,7 @@ class CouchbaseBucketAdapter extends AbstractAdapter
private \CouchbaseBucket $bucket;
private MarshallerInterface $marshaller;
public function __construct(\CouchbaseBucket $bucket, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
public function __construct(\CouchbaseBucket $bucket, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('Couchbase >= 2.6.0 < 3.0.0 is required.');

View File

@@ -32,7 +32,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
private Collection $connection;
private MarshallerInterface $marshaller;
public function __construct(Collection $connection, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
public function __construct(Collection $connection, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('Couchbase >= 3.0.5 < 4.0.0 is required.');
@@ -183,7 +183,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
}
$upsertOptions = new UpsertOptions();
$upsertOptions->expiry(\DateTimeImmutable::createFromFormat('U', time() + $lifetime));
$upsertOptions->expiry($lifetime);
$ko = [];
foreach ($values as $key => $value) {

View File

@@ -59,7 +59,7 @@ class DoctrineDbalAdapter extends AbstractAdapter implements PruneableInterface
*
* @throws InvalidArgumentException When namespace contains invalid characters
*/
public function __construct(Connection|string $connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], MarshallerInterface $marshaller = null)
public function __construct(Connection|string $connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], ?MarshallerInterface $marshaller = null)
{
if (isset($namespace[0]) && preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) {
throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+.A-Za-z0-9] are allowed.', $match[0]));

View File

@@ -20,7 +20,7 @@ class FilesystemAdapter extends AbstractAdapter implements PruneableInterface
{
use FilesystemTrait;
public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, MarshallerInterface $marshaller = null)
public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null)
{
$this->marshaller = $marshaller ?? new DefaultMarshaller();
parent::__construct('', $defaultLifetime);

View File

@@ -35,7 +35,7 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune
*/
private const TAG_FOLDER = 'tags';
public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, MarshallerInterface $marshaller = null)
public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null)
{
$this->marshaller = new TagAwareMarshaller($marshaller);
parent::__construct('', $defaultLifetime);

View File

@@ -45,7 +45,7 @@ class MemcachedAdapter extends AbstractAdapter
*
* Using a MemcachedAdapter as a pure items store is fine.
*/
public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('Memcached > 3.1.5 is required.');
@@ -114,6 +114,8 @@ class MemcachedAdapter extends AbstractAdapter
$params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) {
if (!empty($m[2])) {
[$username, $password] = explode(':', $m[2], 2) + [1 => null];
$username = rawurldecode($username);
$password = null !== $password ? rawurldecode($password) : null;
}
return 'file:'.($m[1] ?? '');

View File

@@ -37,7 +37,7 @@ class NullAdapter implements AdapterInterface, CacheInterface
);
}
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
$save = true;

View File

@@ -54,7 +54,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
* @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
* @throws InvalidArgumentException When namespace contains invalid characters
*/
public function __construct(#[\SensitiveParameter] \PDO|string $connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], MarshallerInterface $marshaller = null)
public function __construct(#[\SensitiveParameter] \PDO|string $connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], ?MarshallerInterface $marshaller = null)
{
if (\is_string($connOrDsn) && str_contains($connOrDsn, '://')) {
throw new InvalidArgumentException(sprintf('Usage of Doctrine DBAL URL with "%s" is not supported. Use a PDO DSN or "%s" instead.', __CLASS__, DoctrineDbalAdapter::class));
@@ -374,10 +374,10 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
private function isTableMissing(\PDOException $exception): bool
{
$driver = $this->getDriver();
$code = $exception->getCode();
[$sqlState, $code] = $exception->errorInfo ?? [null, $exception->getCode()];
return match ($driver) {
'pgsql' => '42P01' === $code,
'pgsql' => '42P01' === $sqlState,
'sqlite' => str_contains($exception->getMessage(), 'no such table:'),
'oci' => 942 === $code,
'sqlsrv' => 208 === $code,

View File

@@ -78,7 +78,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
return new static($file, $fallbackPool);
}
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
if (!isset($this->values)) {
$this->initialize();

View File

@@ -43,7 +43,7 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
*
* @throws CacheException if OPcache is not enabled
*/
public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, bool $appendOnly = false)
public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, bool $appendOnly = false)
{
$this->appendOnly = $appendOnly;
self::$startTime ??= $_SERVER['REQUEST_TIME'] ?? time();

View File

@@ -80,7 +80,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
);
}
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
if (!$this->pool instanceof CacheInterface) {
return $this->doGet($this, $key, $callback, $beta, $metadata);

View File

@@ -18,7 +18,7 @@ class RedisAdapter extends AbstractAdapter
{
use RedisTrait;
public function __construct(\Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|\Relay\Relay $redis, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
public function __construct(\Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|\Relay\Relay $redis, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
$this->init($redis, $namespace, $defaultLifetime, $marshaller);
}

View File

@@ -60,7 +60,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
private string $redisEvictionPolicy;
private string $namespace;
public function __construct(\Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
public function __construct(\Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if ($redis instanceof \Predis\ClientInterface && $redis->getConnection() instanceof ClusterInterface && !$redis->getConnection() instanceof PredisCluster) {
throw new InvalidArgumentException(sprintf('Unsupported Predis cluster connection: only "%s" is, "%s" given.', PredisCluster::class, get_debug_type($redis->getConnection())));

View File

@@ -51,7 +51,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
private static \Closure $getTagsByKey;
private static \Closure $saveTags;
public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null, float $knownTagVersionsTtl = 0.15)
public function __construct(AdapterInterface $itemsPool, ?AdapterInterface $tagsPool = null, float $knownTagVersionsTtl = 0.15)
{
$this->pool = $itemsPool;
$this->tags = $tagsPool ?? $itemsPool;
@@ -146,8 +146,6 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
foreach ($keys as $key) {
if ('' !== $key && \is_string($key)) {
$commit = $commit || isset($this->deferred[$key]);
$key = static::TAGS_PREFIX.$key;
$tagKeys[$key] = $key; // BC with pools populated before v6.1
}
}
@@ -156,7 +154,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
}
try {
$items = $this->pool->getItems($tagKeys + $keys);
$items = $this->pool->getItems($keys);
} catch (InvalidArgumentException $e) {
$this->pool->getItems($keys); // Should throw an exception
@@ -166,18 +164,24 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
$bufferedItems = $itemTags = [];
foreach ($items as $key => $item) {
if (isset($tagKeys[$key])) { // BC with pools populated before v6.1
if ($item->isHit()) {
$itemTags[substr($key, \strlen(static::TAGS_PREFIX))] = $item->get() ?: [];
}
continue;
}
if (null !== $tags = $item->getMetadata()[CacheItem::METADATA_TAGS] ?? null) {
$itemTags[$key] = $tags;
}
$bufferedItems[$key] = $item;
if (null === $tags) {
$key = "\0tags\0".$key;
$tagKeys[$key] = $key; // BC with pools populated before v6.1
}
}
if ($tagKeys) {
foreach ($this->pool->getItems($tagKeys) as $key => $item) {
if ($item->isHit()) {
$itemTags[substr($key, \strlen("\0tags\0"))] = $item->get() ?: [];
}
}
}
$tagVersions = $this->getTagVersions($itemTags, false);
@@ -222,7 +226,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
{
foreach ($keys as $key) {
if ('' !== $key && \is_string($key)) {
$keys[] = static::TAGS_PREFIX.$key; // BC with pools populated before v6.1
$keys[] = "\0tags\0".$key; // BC with pools populated before v6.1
}
}

View File

@@ -35,7 +35,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
$this->pool = $pool;
}
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null): mixed
public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null): mixed
{
if (!$this->pool instanceof CacheInterface) {
throw new \BadMethodCallException(sprintf('Cannot call "%s::get()": this class doesn\'t implement "%s".', get_debug_type($this->pool), CacheInterface::class));

View File

@@ -36,7 +36,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter
$this->instances[$name] = $instance;
}
public function collect(Request $request, Response $response, \Throwable $exception = null): void
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
$empty = ['calls' => [], 'adapters' => [], 'config' => [], 'options' => [], 'statistics' => []];
$this->data = ['instances' => $empty, 'total' => $empty];

View File

@@ -181,11 +181,11 @@ class CachePoolPass implements CompilerPassInterface
$container->removeDefinition('cache.early_expiration_handler');
}
$notAliasedCacheClearerId = $aliasedCacheClearerId = 'cache.global_clearer';
while ($container->hasAlias('cache.global_clearer')) {
$aliasedCacheClearerId = (string) $container->getAlias('cache.global_clearer');
$notAliasedCacheClearerId = 'cache.global_clearer';
while ($container->hasAlias($notAliasedCacheClearerId)) {
$notAliasedCacheClearerId = (string) $container->getAlias($notAliasedCacheClearerId);
}
if ($container->hasDefinition($aliasedCacheClearerId)) {
if ($container->hasDefinition($notAliasedCacheClearerId)) {
$clearers[$notAliasedCacheClearerId] = $allPools;
}

View File

@@ -83,7 +83,7 @@ final class LockRegistry
return $previousFiles;
}
public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata = null, LoggerInterface $logger = null): mixed
public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, ?\Closure $setMetadata = null, ?LoggerInterface $logger = null): mixed
{
if ('\\' === \DIRECTORY_SEPARATOR && null === self::$lockedFiles) {
// disable locking on Windows by default

View File

@@ -23,7 +23,7 @@ class DefaultMarshaller implements MarshallerInterface
private bool $useIgbinarySerialize = true;
private bool $throwOnSerializationFailure = false;
public function __construct(bool $useIgbinarySerialize = null, bool $throwOnSerializationFailure = false)
public function __construct(?bool $useIgbinarySerialize = null, bool $throwOnSerializationFailure = false)
{
if (null === $useIgbinarySerialize) {
$useIgbinarySerialize = \extension_loaded('igbinary') && version_compare('3.1.6', phpversion('igbinary'), '<=');

View File

@@ -29,7 +29,7 @@ class SodiumMarshaller implements MarshallerInterface
* more rotating keys can be provided to decrypt values;
* each key must be generated using sodium_crypto_box_keypair()
*/
public function __construct(array $decryptionKeys, MarshallerInterface $marshaller = null)
public function __construct(array $decryptionKeys, ?MarshallerInterface $marshaller = null)
{
if (!self::isSupported()) {
throw new CacheException('The "sodium" PHP extension is not loaded.');

View File

@@ -20,7 +20,7 @@ class TagAwareMarshaller implements MarshallerInterface
{
private MarshallerInterface $marshaller;
public function __construct(MarshallerInterface $marshaller = null)
public function __construct(?MarshallerInterface $marshaller = null)
{
$this->marshaller = $marshaller ?? new DefaultMarshaller();
}

View File

@@ -27,7 +27,7 @@ class EarlyExpirationDispatcher
private ReverseContainer $reverseContainer;
private ?\Closure $callbackWrapper;
public function __construct(MessageBusInterface $bus, ReverseContainer $reverseContainer, callable $callbackWrapper = null)
public function __construct(MessageBusInterface $bus, ReverseContainer $reverseContainer, ?callable $callbackWrapper = null)
{
$this->bus = $bus;
$this->reverseContainer = $reverseContainer;
@@ -37,7 +37,7 @@ class EarlyExpirationDispatcher
/**
* @return mixed
*/
public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, LoggerInterface $logger = null)
public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, ?LoggerInterface $logger = null)
{
if (!$item->isHit() || null === $message = EarlyExpirationMessage::create($this->reverseContainer, $callback, $item, $pool)) {
// The item is stale or the callback cannot be reversed: we must compute the value now

View File

@@ -59,7 +59,7 @@ trait ContractsTrait
return $previousWrapper;
}
private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null): mixed
private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, ?array &$metadata = null): mixed
{
if (0 > $beta ??= 1.0) {
throw new InvalidArgumentException(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta));

View File

@@ -85,7 +85,7 @@ trait FilesystemCommonTrait
return @unlink($file);
}
private function write(string $file, string $data, int $expiresAt = null): bool
private function write(string $file, string $data, ?int $expiresAt = null): bool
{
$unlink = false;
set_error_handler(static fn ($type, $message, $file, $line) => throw new \ErrorException($message, 0, $type, $file, $line));
@@ -109,8 +109,13 @@ trait FilesystemCommonTrait
touch($tmp, $expiresAt ?: time() + 31556952); // 1 year in seconds
}
$success = rename($tmp, $file);
$unlink = !$success;
if ('\\' === \DIRECTORY_SEPARATOR) {
$success = copy($tmp, $file);
$unlink = true;
} else {
$success = rename($tmp, $file);
$unlink = !$success;
}
return $success;
} finally {
@@ -122,7 +127,7 @@ trait FilesystemCommonTrait
}
}
private function getFile(string $id, bool $mkdir = false, string $directory = null): string
private function getFile(string $id, bool $mkdir = false, ?string $directory = null): string
{
// Use xxh128 to favor speed over security, which is not an issue here
$hash = str_replace('/', '-', base64_encode(hash('xxh128', static::class.$id, true)));

View File

@@ -81,7 +81,7 @@ class Redis5Proxy extends \Redis implements ResetInterface, LazyObjectInterface
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->append(...\func_get_args());
}
public function auth($auth)
public function auth(#[\SensitiveParameter] $auth)
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->auth(...\func_get_args());
}

View File

@@ -25,6 +25,7 @@ class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class);
*/
class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface
{
use Redis6ProxyTrait;
use LazyProxyTrait {
resetLazyObject as reset;
}
@@ -226,11 +227,6 @@ class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->discard(...\func_get_args());
}
public function dump($key): \Redis|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
}
public function echo($str): \Redis|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args());
@@ -511,16 +507,6 @@ class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hMset(...\func_get_args());
}
public function hRandField($key, $options = null): \Redis|array|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hRandField(...\func_get_args());
}
public function hSet($key, $member, $value): \Redis|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSet(...\func_get_args());
}
public function hSetNx($key, $field, $value): \Redis|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hSetNx(...\func_get_args());
@@ -651,11 +637,6 @@ class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ltrim(...\func_get_args());
}
public function mget($keys): \Redis|array
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->mget(...\func_get_args());
}
public function migrate($host, $port, $key, $dstdb, $timeout, $copy = false, $replace = false, #[\SensitiveParameter] $credentials = null): \Redis|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args());
@@ -866,11 +847,6 @@ class Redis6Proxy extends \Redis implements ResetInterface, LazyObjectInterface
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sPop(...\func_get_args());
}
public function sRandMember($key, $count = 0): \Redis|array|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sRandMember(...\func_get_args());
}
public function sUnion($key, ...$other_keys): \Redis|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->sUnion(...\func_get_args());

View File

@@ -31,7 +31,7 @@ class RedisCluster5Proxy extends \RedisCluster implements ResetInterface, LazyOb
private const LAZY_OBJECT_PROPERTY_SCOPES = [];
public function __construct($name, $seeds = null, $timeout = null, $read_timeout = null, $persistent = null, $auth = null)
public function __construct($name, $seeds = null, $timeout = null, $read_timeout = null, $persistent = null, #[\SensitiveParameter] $auth = null)
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->__construct(...\func_get_args());
}

View File

@@ -25,6 +25,7 @@ class_exists(\Symfony\Component\VarExporter\Internal\LazyObjectState::class);
*/
class RedisCluster6Proxy extends \RedisCluster implements ResetInterface, LazyObjectInterface
{
use RedisCluster6ProxyTrait;
use LazyProxyTrait {
resetLazyObject as reset;
}
@@ -656,11 +657,6 @@ class RedisCluster6Proxy extends \RedisCluster implements ResetInterface, LazyOb
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pttl(...\func_get_args());
}
public function publish($channel, $message): \RedisCluster|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->publish(...\func_get_args());
}
public function pubsub($key_or_address, ...$values): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pubsub(...\func_get_args());

View File

@@ -149,10 +149,10 @@ trait RedisTrait
if (isset($params['host']) || isset($params['path'])) {
if (!isset($params['dbindex']) && isset($params['path'])) {
if (preg_match('#/(\d+)?$#', $params['path'], $m)) {
$params['dbindex'] = $m[1] ?? '0';
$params['dbindex'] = $m[1] ?? $query['dbindex'] ?? '0';
$params['path'] = substr($params['path'], 0, -\strlen($m[0]));
} elseif (isset($params['host'])) {
throw new InvalidArgumentException('Invalid Redis DSN: query parameter "dbindex" must be a number.');
throw new InvalidArgumentException('Invalid Redis DSN: parameter "dbindex" must be a number.');
}
}
@@ -167,6 +167,10 @@ trait RedisTrait
throw new InvalidArgumentException('Invalid Redis DSN: missing host.');
}
if (isset($params['dbindex'], $query['dbindex']) && $params['dbindex'] !== $query['dbindex']) {
throw new InvalidArgumentException('Invalid Redis DSN: path and query "dbindex" parameters mismatch.');
}
$params += $query + $options + self::$defaultConnectionOptions;
if (isset($params['redis_sentinel']) && !class_exists(\Predis\Client::class) && !class_exists(\RedisSentinel::class) && !class_exists(Sentinel::class)) {
@@ -228,10 +232,10 @@ trait RedisTrait
$options = [
'host' => $host,
'port' => $port,
'connectTimeout' => $params['timeout'],
'connectTimeout' => (float) $params['timeout'],
'persistent' => $params['persistent_id'],
'retryInterval' => $params['retry_interval'],
'readTimeout' => $params['read_timeout'],
'retryInterval' => (int) $params['retry_interval'],
'readTimeout' => (float) $params['read_timeout'],
];
if ($passAuth) {
@@ -260,6 +264,22 @@ trait RedisTrait
$extra = [
'stream' => $params['ssl'] ?? null,
];
$booleanStreamOptions = [
'allow_self_signed',
'capture_peer_cert',
'capture_peer_cert_chain',
'disable_compression',
'SNI_enabled',
'verify_peer',
'verify_peer_name',
];
foreach ($extra['stream'] ?? [] as $streamOption => $value) {
if (\in_array($streamOption, $booleanStreamOptions, true) && \is_string($value)) {
$extra['stream'][$streamOption] = filter_var($value, \FILTER_VALIDATE_BOOL);
}
}
if (isset($params['auth'])) {
$extra['auth'] = $params['auth'];
}
@@ -277,7 +297,10 @@ trait RedisTrait
}
if ((null !== $auth && !$redis->auth($auth))
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
// Due to a bug in phpredis we must always select the dbindex if persistent pooling is enabled
// @see https://github.com/phpredis/phpredis/issues/1920
// @see https://github.com/symfony/symfony/issues/51578
|| (($params['dbindex'] || ('pconnect' === $connect && '0' !== \ini_get('redis.pconnect.pooling_enabled'))) && !$redis->select($params['dbindex']))
) {
$e = preg_replace('/^ERR /', '', $redis->getLastError());
throw new InvalidArgumentException('Redis connection failed: '.$e.'.');
@@ -498,7 +521,7 @@ trait RedisTrait
}
$this->doDelete($keys);
}
} while ($cursor = (int) $cursor);
} while ($cursor);
}
return $cleared;
@@ -563,7 +586,7 @@ trait RedisTrait
return $failed;
}
private function pipeline(\Closure $generator, object $redis = null): \Generator
private function pipeline(\Closure $generator, ?object $redis = null): \Generator
{
$ids = [];
$redis ??= $this->redis;

View File

@@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.11', '>=')) {
/**
* @internal
*/
trait BgsaveTrait
{
public function bgsave($arg = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgsave(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait BgsaveTrait
{
public function bgsave($schedule = false): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgsave(...\func_get_args());
}
}
}

View File

@@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.8.1', '>=')) {
/**
* @internal
*/
trait CopyTrait
{
public function copy($src, $dst, $options = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait CopyTrait
{
public function copy($src, $dst, $options = null): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
}
}
}

View File

@@ -1,132 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait FtTrait
{
public function ftAggregate($index, $query, $options = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAggregate(...\func_get_args());
}
public function ftAliasAdd($index, $alias): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAliasAdd(...\func_get_args());
}
public function ftAliasDel($alias): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAliasDel(...\func_get_args());
}
public function ftAliasUpdate($index, $alias): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAliasUpdate(...\func_get_args());
}
public function ftAlter($index, $schema, $skipinitialscan = false): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftAlter(...\func_get_args());
}
public function ftConfig($operation, $option, $value = null): \Relay\Relay|array|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftConfig(...\func_get_args());
}
public function ftCreate($index, $schema, $options = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftCreate(...\func_get_args());
}
public function ftCursor($operation, $index, $cursor, $options = null): \Relay\Relay|array|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftCursor(...\func_get_args());
}
public function ftDictAdd($dict, $term, ...$other_terms): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDictAdd(...\func_get_args());
}
public function ftDictDel($dict, $term, ...$other_terms): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDictDel(...\func_get_args());
}
public function ftDictDump($dict): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDictDump(...\func_get_args());
}
public function ftDropIndex($index, $dd = false): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftDropIndex(...\func_get_args());
}
public function ftExplain($index, $query, $dialect = 0): \Relay\Relay|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftExplain(...\func_get_args());
}
public function ftExplainCli($index, $query, $dialect = 0): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftExplainCli(...\func_get_args());
}
public function ftInfo($index): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftInfo(...\func_get_args());
}
public function ftProfile($index, $command, $query, $limited = false): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftProfile(...\func_get_args());
}
public function ftSearch($index, $query, $options = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSearch(...\func_get_args());
}
public function ftSpellCheck($index, $query, $options = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSpellCheck(...\func_get_args());
}
public function ftSynDump($index): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSynDump(...\func_get_args());
}
public function ftSynUpdate($index, $synonym, $term_or_terms, $skipinitialscan = false): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftSynUpdate(...\func_get_args());
}
public function ftTagVals($index, $tag): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->ftTagVals(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait FtTrait
{
}
}

View File

@@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait GeosearchTrait
{
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait GeosearchTrait
{
public function geosearch($key, $position, $shape, $unit, $options = []): \Relay\Relay|array
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geosearch(...\func_get_args());
}
}
}

View File

@@ -1,32 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.10.1', '>=')) {
/**
* @internal
*/
trait GetWithMetaTrait
{
public function getWithMeta($key): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getWithMeta(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait GetWithMetaTrait
{
}
}

View File

@@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait GetrangeTrait
{
public function getrange($key, $start, $end): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait GetrangeTrait
{
public function getrange($key, $start, $end): \Relay\Relay|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getrange(...\func_get_args());
}
}
}

View File

@@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait HsetTrait
{
public function hset($key, ...$keys_and_vals): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait HsetTrait
{
public function hset($key, $mem, $val, ...$kvals): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hset(...\func_get_args());
}
}
}

View File

@@ -1,32 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.11.1', '>=')) {
/**
* @internal
*/
trait IsTrackedTrait
{
public function isTracked($key): bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->isTracked(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait IsTrackedTrait
{
}
}

View File

@@ -1,46 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait MoveTrait
{
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args());
}
public function lmove($srckey, $dstkey, $srcpos, $dstpos): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait MoveTrait
{
public function blmove($srckey, $dstkey, $srcpos, $dstpos, $timeout): \Relay\Relay|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->blmove(...\func_get_args());
}
public function lmove($srckey, $dstkey, $srcpos, $dstpos): \Relay\Relay|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lmove(...\func_get_args());
}
}
}

View File

@@ -1,96 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait NullableReturnTrait
{
public function dump($key): \Relay\Relay|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
}
public function geodist($key, $src, $dst, $unit = null): \Relay\Relay|false|float|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args());
}
public function hrandfield($hash, $options = null): \Relay\Relay|array|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args());
}
public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Relay\Relay|false|string|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args());
}
public function zrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args());
}
public function zrevrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args());
}
public function zscore($key, $member): \Relay\Relay|false|float|null
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait NullableReturnTrait
{
public function dump($key): \Relay\Relay|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->dump(...\func_get_args());
}
public function geodist($key, $src, $dst, $unit = null): \Relay\Relay|false|float
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->geodist(...\func_get_args());
}
public function hrandfield($hash, $options = null): \Relay\Relay|array|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hrandfield(...\func_get_args());
}
public function xadd($key, $id, $values, $maxlen = 0, $approx = false, $nomkstream = false): \Relay\Relay|false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->xadd(...\func_get_args());
}
public function zrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrank(...\func_get_args());
}
public function zrevrank($key, $rank, $withscore = false): \Relay\Relay|array|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zrevrank(...\func_get_args());
}
public function zscore($key, $member): \Relay\Relay|false|float
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->zscore(...\func_get_args());
}
}
}

View File

@@ -1,36 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait PfcountTrait
{
public function pfcount($key_or_keys): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait PfcountTrait
{
public function pfcount($key): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->pfcount(...\func_get_args());
}
}
}

View File

@@ -1,132 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.11.0', '>=')) {
/**
* @internal
*/
trait Relay11Trait
{
public function cmsIncrBy($key, $field, $value, ...$fields_and_falues): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsIncrBy(...\func_get_args());
}
public function cmsInfo($key): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsInfo(...\func_get_args());
}
public function cmsInitByDim($key, $width, $depth): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsInitByDim(...\func_get_args());
}
public function cmsInitByProb($key, $error, $probability): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsInitByProb(...\func_get_args());
}
public function cmsMerge($dstkey, $keys, $weights = []): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsMerge(...\func_get_args());
}
public function cmsQuery($key, ...$fields): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->cmsQuery(...\func_get_args());
}
public function commandlog($subcmd, ...$args): \Relay\Relay|array|bool|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->commandlog(...\func_get_args());
}
public function hexpire($hash, $ttl, $fields, $mode = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexpire(...\func_get_args());
}
public function hexpireat($hash, $ttl, $fields, $mode = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexpireat(...\func_get_args());
}
public function hexpiretime($hash, $fields): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hexpiretime(...\func_get_args());
}
public function hgetdel($key, $fields): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hgetdel(...\func_get_args());
}
public function hgetex($hash, $fields, $expiry = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hgetex(...\func_get_args());
}
public function hpersist($hash, $fields): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpersist(...\func_get_args());
}
public function hpexpire($hash, $ttl, $fields, $mode = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpexpire(...\func_get_args());
}
public function hpexpireat($hash, $ttl, $fields, $mode = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpexpireat(...\func_get_args());
}
public function hpexpiretime($hash, $fields): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpexpiretime(...\func_get_args());
}
public function hpttl($hash, $fields): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hpttl(...\func_get_args());
}
public function hsetex($key, $fields, $expiry = null): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->hsetex(...\func_get_args());
}
public function httl($hash, $fields): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->httl(...\func_get_args());
}
public function serverName(): false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->serverName(...\func_get_args());
}
public function serverVersion(): false|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->serverVersion(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait Relay11Trait
{
}
}

View File

@@ -1,32 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Cache\Traits\Relay;
if (version_compare(phpversion('relay'), '0.9.0', '>=')) {
/**
* @internal
*/
trait SwapdbTrait
{
public function swapdb($index1, $index2): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->swapdb(...\func_get_args());
}
}
} else {
/**
* @internal
*/
trait SwapdbTrait
{
}
}

View File

@@ -28,6 +28,7 @@ class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInter
use LazyProxyTrait {
resetLazyObject as reset;
}
use RelayProxyTrait;
private const LAZY_OBJECT_PROPERTY_SCOPES = [];
@@ -236,12 +237,12 @@ class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInter
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->info(...\func_get_args());
}
public function flushdb($async = false): \Relay\Relay|bool
public function flushdb($sync = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushdb(...\func_get_args());
}
public function flushall($async = false): \Relay\Relay|bool
public function flushall($sync = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->flushall(...\func_get_args());
}
@@ -276,6 +277,11 @@ class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInter
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->replicaof(...\func_get_args());
}
public function waitaof($numlocal, $numremote, $timeout): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->waitaof(...\func_get_args());
}
public function restore($key, $ttl, $value, $options = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->restore(...\func_get_args());
@@ -286,11 +292,6 @@ class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInter
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->migrate(...\func_get_args());
}
public function copy($src, $dst, $options = null): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
}
public function echo($arg): \Relay\Relay|bool|string
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->echo(...\func_get_args());
@@ -326,6 +327,11 @@ class RelayProxy extends \Relay\Relay implements ResetInterface, LazyObjectInter
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lastsave(...\func_get_args());
}
public function lcs($key1, $key2, $options = null): mixed
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->lcs(...\func_get_args());
}
public function bgsave($schedule = false): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->bgsave(...\func_get_args());

View File

@@ -17,6 +17,11 @@ if (version_compare(phpversion('relay'), '0.8.1', '>=')) {
*/
trait RelayProxyTrait
{
public function copy($src, $dst, $options = null): \Relay\Relay|bool
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
}
public function jsonArrAppend($key, $value_or_array, $path = null): \Relay\Relay|array|false
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->jsonArrAppend(...\func_get_args());
@@ -143,5 +148,9 @@ if (version_compare(phpversion('relay'), '0.8.1', '>=')) {
*/
trait RelayProxyTrait
{
public function copy($src, $dst, $options = null): \Relay\Relay|false|int
{
return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->copy(...\func_get_args());
}
}
}