mirror of
https://github.com/symfony/cache.git
synced 2026-03-23 23:22:07 +01:00
Merge branch '7.0' into 7.1
* 7.0: List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters minor #53524 [Messenger] [AmazonSqs] Allow `async-aws/sqs` version 2 (smoench) Fix bad merge List CS fix in .git-blame-ignore-revs Fix implicitly-required parameters List CS fix in .git-blame-ignore-revs Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value [Messenger][AmazonSqs] Allow async-aws/sqs version 2
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -26,7 +26,7 @@ class ApcuAdapter extends AbstractAdapter
|
||||
public function __construct(
|
||||
string $namespace = '',
|
||||
int $defaultLifetime = 0,
|
||||
string $version = null,
|
||||
?string $version = null,
|
||||
private ?MarshallerInterface $marshaller = null,
|
||||
) {
|
||||
if (!static::isSupported()) {
|
||||
|
||||
@@ -70,7 +70,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();
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -46,7 +46,7 @@ class CouchbaseBucketAdapter extends AbstractAdapter
|
||||
private \CouchbaseBucket $bucket,
|
||||
string $namespace = '',
|
||||
int $defaultLifetime = 0,
|
||||
MarshallerInterface $marshaller = null,
|
||||
?MarshallerInterface $marshaller = null,
|
||||
) {
|
||||
if (!static::isSupported()) {
|
||||
throw new CacheException('Couchbase >= 2.6.0 < 3.0.0 is required.');
|
||||
|
||||
@@ -35,7 +35,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
|
||||
private Collection $connection,
|
||||
string $namespace = '',
|
||||
int $defaultLifetime = 0,
|
||||
MarshallerInterface $marshaller = null,
|
||||
?MarshallerInterface $marshaller = null,
|
||||
) {
|
||||
if (!static::isSupported()) {
|
||||
throw new CacheException('Couchbase >= 3.0.5 < 4.0.0 is required.');
|
||||
|
||||
@@ -60,7 +60,7 @@ class DoctrineDbalAdapter extends AbstractAdapter implements PruneableInterface
|
||||
private string $namespace = '',
|
||||
int $defaultLifetime = 0,
|
||||
array $options = [],
|
||||
MarshallerInterface $marshaller = null,
|
||||
?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]));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.');
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -45,7 +45,7 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
|
||||
public function __construct(
|
||||
string $namespace = '',
|
||||
int $defaultLifetime = 0,
|
||||
string $directory = null,
|
||||
?string $directory = null,
|
||||
private bool $appendOnly = false,
|
||||
) {
|
||||
self::$startTime ??= $_SERVER['REQUEST_TIME'] ?? time();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
|
||||
\Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis,
|
||||
private string $namespace = '',
|
||||
int $defaultLifetime = 0,
|
||||
MarshallerInterface $marshaller = null,
|
||||
?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())));
|
||||
|
||||
@@ -52,7 +52,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
||||
|
||||
public function __construct(
|
||||
AdapterInterface $itemsPool,
|
||||
AdapterInterface $tagsPool = null,
|
||||
?AdapterInterface $tagsPool = null,
|
||||
private float $knownTagVersionsTtl = 0.15,
|
||||
) {
|
||||
$this->pool = $itemsPool;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'), '<=');
|
||||
|
||||
@@ -30,7 +30,7 @@ class SodiumMarshaller implements MarshallerInterface
|
||||
*/
|
||||
public function __construct(
|
||||
private array $decryptionKeys,
|
||||
MarshallerInterface $marshaller = null,
|
||||
?MarshallerInterface $marshaller = null,
|
||||
) {
|
||||
if (!self::isSupported()) {
|
||||
throw new CacheException('The "sodium" PHP extension is not loaded.');
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ class EarlyExpirationDispatcher
|
||||
public function __construct(
|
||||
private MessageBusInterface $bus,
|
||||
private ReverseContainer $reverseContainer,
|
||||
callable $callbackWrapper = null,
|
||||
?callable $callbackWrapper = null,
|
||||
) {
|
||||
$this->callbackWrapper = null === $callbackWrapper ? null : $callbackWrapper(...);
|
||||
}
|
||||
|
||||
public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, LoggerInterface $logger = null): mixed
|
||||
public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, ?LoggerInterface $logger = null): mixed
|
||||
{
|
||||
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
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class AbstractRedisAdapterTestCase extends AdapterTestCase
|
||||
|
||||
protected static \Redis|Relay|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis;
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ abstract class AdapterTestCase extends CachePoolTest
|
||||
/** @var PruneableInterface|CacheItemPoolInterface $cache */
|
||||
$cache = $this->createCachePool();
|
||||
|
||||
$doSet = function ($name, $value, \DateInterval $expiresAfter = null) use ($cache) {
|
||||
$doSet = function ($name, $value, ?\DateInterval $expiresAfter = null) use ($cache) {
|
||||
$item = $cache->getItem($name);
|
||||
$item->set($value);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
*/
|
||||
class ChainAdapterTest extends AdapterTestCase
|
||||
{
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testGetMetadata' === $testMethod) {
|
||||
return new ChainAdapter([new FilesystemAdapter('a', $defaultLifetime), new FilesystemAdapter('b', $defaultLifetime)], $defaultLifetime);
|
||||
|
||||
@@ -107,7 +107,7 @@ class DoctrineDbalAdapterTest extends AdapterTestCase
|
||||
/**
|
||||
* @dataProvider provideDsnWithSQLite
|
||||
*/
|
||||
public function testDsnWithSQLite(string $dsn, string $file = null)
|
||||
public function testDsnWithSQLite(string $dsn, ?string $file = null)
|
||||
{
|
||||
try {
|
||||
$pool = new DoctrineDbalAdapter($dsn);
|
||||
|
||||
@@ -43,7 +43,7 @@ class MemcachedAdapterTest extends AdapterTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null, string $namespace = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null, ?string $namespace = null): CacheItemPoolInterface
|
||||
{
|
||||
$client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST')) : self::$client;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
||||
*/
|
||||
class NamespacedProxyAdapterTest extends ProxyAdapterTest
|
||||
{
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testGetMetadata' === $testMethod) {
|
||||
return new ProxyAdapter(new FilesystemAdapter(), 'foo', $defaultLifetime);
|
||||
|
||||
@@ -79,7 +79,7 @@ class PdoAdapterTest extends AdapterTestCase
|
||||
/**
|
||||
* @dataProvider provideDsnSQLite
|
||||
*/
|
||||
public function testDsnWithSQLite(string $dsn, string $file = null)
|
||||
public function testDsnWithSQLite(string $dsn, ?string $file = null)
|
||||
{
|
||||
try {
|
||||
$pool = new PdoAdapter($dsn);
|
||||
|
||||
@@ -75,7 +75,7 @@ class PhpArrayAdapterTest extends AdapterTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testGetMetadata' === $testMethod || 'testClearPrefix' === $testMethod) {
|
||||
return new PhpArrayAdapter(self::$file, new FilesystemAdapter());
|
||||
|
||||
@@ -27,7 +27,7 @@ class PredisTagAwareAdapterTest extends PredisAdapterTest
|
||||
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
$this->assertInstanceOf(\Predis\Client::class, self::$redis);
|
||||
$adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
|
||||
|
||||
@@ -27,7 +27,7 @@ class PredisTagAwareClusterAdapterTest extends PredisClusterAdapterTest
|
||||
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
$this->assertInstanceOf(\Predis\Client::class, self::$redis);
|
||||
$adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
|
||||
|
||||
@@ -32,7 +32,7 @@ class ProxyAdapterAndRedisAdapterTest extends AbstractRedisAdapterTestCase
|
||||
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'));
|
||||
}
|
||||
|
||||
public function createCachePool($defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool($defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
return new ProxyAdapter(new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), 100), 'ProxyNS', $defaultLifetime);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class ProxyAdapterTest extends AdapterTestCase
|
||||
'testPrune' => 'ProxyAdapter just proxies',
|
||||
];
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testGetMetadata' === $testMethod) {
|
||||
return new ProxyAdapter(new FilesystemAdapter(), '', $defaultLifetime);
|
||||
|
||||
@@ -28,7 +28,7 @@ class RedisAdapterTest extends AbstractRedisAdapterTestCase
|
||||
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]);
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
|
||||
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
|
||||
|
||||
@@ -35,7 +35,7 @@ class RedisClusterAdapterTest extends AbstractRedisAdapterTestCase
|
||||
self::$redis->setOption(\Redis::OPT_PREFIX, 'prefix_');
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
|
||||
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
|
||||
|
||||
@@ -28,7 +28,7 @@ class RedisTagAwareAdapterTest extends RedisAdapterTest
|
||||
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
|
||||
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
|
||||
|
||||
@@ -27,7 +27,7 @@ class RedisTagAwareArrayAdapterTest extends RedisArrayAdapterTest
|
||||
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
|
||||
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
|
||||
|
||||
@@ -28,7 +28,7 @@ class RedisTagAwareClusterAdapterTest extends RedisClusterAdapterTest
|
||||
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
|
||||
}
|
||||
|
||||
public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
|
||||
public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
|
||||
{
|
||||
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
|
||||
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -82,7 +82,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));
|
||||
@@ -119,7 +119,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)));
|
||||
|
||||
@@ -569,7 +569,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;
|
||||
|
||||
Reference in New Issue
Block a user