summaryrefslogtreecommitdiff
path: root/vendor/symfony/cache/Adapter
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/cache/Adapter')
-rw-r--r--vendor/symfony/cache/Adapter/AbstractAdapter.php36
-rw-r--r--vendor/symfony/cache/Adapter/AdapterInterface.php2
-rw-r--r--vendor/symfony/cache/Adapter/ArrayAdapter.php2
-rw-r--r--vendor/symfony/cache/Adapter/ChainAdapter.php10
-rw-r--r--vendor/symfony/cache/Adapter/NullAdapter.php4
-rw-r--r--vendor/symfony/cache/Adapter/PdoAdapter.php4
-rw-r--r--vendor/symfony/cache/Adapter/PhpArrayAdapter.php12
-rw-r--r--vendor/symfony/cache/Adapter/ProxyAdapter.php4
-rw-r--r--vendor/symfony/cache/Adapter/TagAwareAdapter.php40
-rw-r--r--vendor/symfony/cache/Adapter/TraceableAdapter.php8
10 files changed, 61 insertions, 61 deletions
diff --git a/vendor/symfony/cache/Adapter/AbstractAdapter.php b/vendor/symfony/cache/Adapter/AbstractAdapter.php
index 571eb1468a..d93ae711bd 100644
--- a/vendor/symfony/cache/Adapter/AbstractAdapter.php
+++ b/vendor/symfony/cache/Adapter/AbstractAdapter.php
@@ -64,12 +64,12 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
null,
CacheItem::class
);
- $getId = \Closure::fromCallable(array($this, 'getId'));
+ $getId = \Closure::fromCallable([$this, 'getId']);
$this->mergeByLifetime = \Closure::bind(
function ($deferred, $namespace, &$expiredIds) use ($getId) {
- $byLifetime = array();
+ $byLifetime = [];
$now = microtime(true);
- $expiredIds = array();
+ $expiredIds = [];
foreach ($deferred as $key => $item) {
$key = (string) $key;
@@ -83,7 +83,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
unset($metadata[CacheItem::METADATA_TAGS]);
}
// For compactness, expiry and creation duration are packed in the key of an array, using magic numbers as separators
- $byLifetime[$ttl][$getId($key)] = $metadata ? array("\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item->value) : $item->value;
+ $byLifetime[$ttl][$getId($key)] = $metadata ? ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item->value] : $item->value;
}
return $byLifetime;
@@ -131,7 +131,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
return $apcu;
}
- public static function createConnection($dsn, array $options = array())
+ public static function createConnection($dsn, array $options = [])
{
if (!\is_string($dsn)) {
throw new InvalidArgumentException(sprintf('The %s() method expect argument #1 to be string, %s given.', __METHOD__, \gettype($dsn)));
@@ -161,11 +161,11 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$value = null;
try {
- foreach ($this->doFetch(array($id)) as $value) {
+ foreach ($this->doFetch([$id]) as $value) {
$isHit = true;
}
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch key "{key}"', array('key' => $key, 'exception' => $e));
+ CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]);
}
return $f($key, $value, $isHit);
@@ -174,12 +174,12 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
if ($this->deferred) {
$this->commit();
}
- $ids = array();
+ $ids = [];
foreach ($keys as $key) {
$ids[] = $this->getId($key);
@@ -187,8 +187,8 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
try {
$items = $this->doFetch($ids);
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => $keys, 'exception' => $e));
- $items = array();
+ CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => $keys, 'exception' => $e]);
+ $items = [];
}
$ids = array_combine($ids, $keys);
@@ -229,7 +229,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$ok = true;
$byLifetime = $this->mergeByLifetime;
$byLifetime = $byLifetime($this->deferred, $this->namespace, $expiredIds);
- $retry = $this->deferred = array();
+ $retry = $this->deferred = [];
if ($expiredIds) {
$this->doDelete($expiredIds);
@@ -239,7 +239,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$e = $this->doSave($values, $lifetime);
} catch (\Exception $e) {
}
- if (true === $e || array() === $e) {
+ if (true === $e || [] === $e) {
continue;
}
if (\is_array($e) || 1 === \count($values)) {
@@ -247,7 +247,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
$ok = false;
$v = $values[$id];
$type = \is_object($v) ? \get_class($v) : \gettype($v);
- CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null));
+ CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]);
}
} else {
foreach ($values as $id => $v) {
@@ -261,15 +261,15 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
foreach ($ids as $id) {
try {
$v = $byLifetime[$lifetime][$id];
- $e = $this->doSave(array($id => $v), $lifetime);
+ $e = $this->doSave([$id => $v], $lifetime);
} catch (\Exception $e) {
}
- if (true === $e || array() === $e) {
+ if (true === $e || [] === $e) {
continue;
}
$ok = false;
$type = \is_object($v) ? \get_class($v) : \gettype($v);
- CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null));
+ CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]);
}
}
@@ -297,7 +297,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
yield $key => $f($key, $value, true);
}
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => array_values($keys), 'exception' => $e));
+ CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => array_values($keys), 'exception' => $e]);
}
foreach ($keys as $key) {
diff --git a/vendor/symfony/cache/Adapter/AdapterInterface.php b/vendor/symfony/cache/Adapter/AdapterInterface.php
index 41222c1ab5..85fe07684f 100644
--- a/vendor/symfony/cache/Adapter/AdapterInterface.php
+++ b/vendor/symfony/cache/Adapter/AdapterInterface.php
@@ -33,5 +33,5 @@ interface AdapterInterface extends CacheItemPoolInterface
*
* @return \Traversable|CacheItem[]
*/
- public function getItems(array $keys = array());
+ public function getItems(array $keys = []);
}
diff --git a/vendor/symfony/cache/Adapter/ArrayAdapter.php b/vendor/symfony/cache/Adapter/ArrayAdapter.php
index 97b6b7f780..bbb1f846e4 100644
--- a/vendor/symfony/cache/Adapter/ArrayAdapter.php
+++ b/vendor/symfony/cache/Adapter/ArrayAdapter.php
@@ -83,7 +83,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
foreach ($keys as $key) {
if (!\is_string($key) || !isset($this->expiries[$key])) {
diff --git a/vendor/symfony/cache/Adapter/ChainAdapter.php b/vendor/symfony/cache/Adapter/ChainAdapter.php
index 0417a22cd1..80aa7c6d1b 100644
--- a/vendor/symfony/cache/Adapter/ChainAdapter.php
+++ b/vendor/symfony/cache/Adapter/ChainAdapter.php
@@ -33,7 +33,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
{
use ContractsTrait;
- private $adapters = array();
+ private $adapters = [];
private $adapterCount;
private $syncItem;
@@ -118,7 +118,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
public function getItem($key)
{
$syncItem = $this->syncItem;
- $misses = array();
+ $misses = [];
foreach ($this->adapters as $i => $adapter) {
$item = $adapter->getItem($key);
@@ -140,15 +140,15 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
return $this->generateItems($this->adapters[0]->getItems($keys), 0);
}
private function generateItems($items, $adapterIndex)
{
- $missing = array();
- $misses = array();
+ $missing = [];
+ $misses = [];
$nextAdapterIndex = $adapterIndex + 1;
$nextAdapter = isset($this->adapters[$nextAdapterIndex]) ? $this->adapters[$nextAdapterIndex] : null;
diff --git a/vendor/symfony/cache/Adapter/NullAdapter.php b/vendor/symfony/cache/Adapter/NullAdapter.php
index 3c88a6902a..f1bdd2bf71 100644
--- a/vendor/symfony/cache/Adapter/NullAdapter.php
+++ b/vendor/symfony/cache/Adapter/NullAdapter.php
@@ -42,7 +42,7 @@ class NullAdapter implements AdapterInterface, CacheInterface
*/
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{
- return $callback(($this->createCacheItem)());
+ return $callback(($this->createCacheItem)($key));
}
/**
@@ -58,7 +58,7 @@ class NullAdapter implements AdapterInterface, CacheInterface
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
return $this->generateItems($keys);
}
diff --git a/vendor/symfony/cache/Adapter/PdoAdapter.php b/vendor/symfony/cache/Adapter/PdoAdapter.php
index eb35fb38a9..d118736aec 100644
--- a/vendor/symfony/cache/Adapter/PdoAdapter.php
+++ b/vendor/symfony/cache/Adapter/PdoAdapter.php
@@ -39,7 +39,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
* * db_time_col: The column where to store the timestamp [default: item_time]
* * db_username: The username when lazy-connect [default: '']
* * db_password: The password when lazy-connect [default: '']
- * * db_connection_options: An array of driver-specific connection options [default: array()]
+ * * db_connection_options: An array of driver-specific connection options [default: []]
*
* @param \PDO|Connection|string $connOrDsn a \PDO or Connection instance or DSN string or null
*
@@ -47,7 +47,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($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = array(), MarshallerInterface $marshaller = null)
+ public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], MarshallerInterface $marshaller = null)
{
$this->init($connOrDsn, $namespace, $defaultLifetime, $options, $marshaller);
}
diff --git a/vendor/symfony/cache/Adapter/PhpArrayAdapter.php b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php
index a145a361d1..129a9e7df4 100644
--- a/vendor/symfony/cache/Adapter/PhpArrayAdapter.php
+++ b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php
@@ -149,7 +149,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
foreach ($keys as $key) {
if (!\is_string($key)) {
@@ -199,7 +199,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
public function deleteItems(array $keys)
{
$deleted = true;
- $fallbackKeys = array();
+ $fallbackKeys = [];
foreach ($keys as $key) {
if (!\is_string($key)) {
@@ -258,7 +258,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
private function generateItems(array $keys): \Generator
{
$f = $this->createCacheItem;
- $fallbackKeys = array();
+ $fallbackKeys = [];
foreach ($keys as $key) {
if (isset($this->keys[$key])) {
@@ -294,10 +294,10 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
{
$e = new \ReflectionException("Class $class does not exist");
$trace = $e->getTrace();
- $autoloadFrame = array(
+ $autoloadFrame = [
'function' => 'spl_autoload_call',
- 'args' => array($class),
- );
+ 'args' => [$class],
+ ];
$i = 1 + array_search($autoloadFrame, $trace, true);
if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) {
diff --git a/vendor/symfony/cache/Adapter/ProxyAdapter.php b/vendor/symfony/cache/Adapter/ProxyAdapter.php
index d6b888788d..f7536b1ee2 100644
--- a/vendor/symfony/cache/Adapter/ProxyAdapter.php
+++ b/vendor/symfony/cache/Adapter/ProxyAdapter.php
@@ -78,7 +78,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
}
if ($metadata) {
// For compactness, expiry and creation duration are packed in the key of an array, using magic numbers as separators
- $item["\0*\0value"] = array("\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item["\0*\0value"]);
+ $item["\0*\0value"] = ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item["\0*\0value"]];
}
$innerItem->set($item["\0*\0value"]);
$innerItem->expiresAt(null !== $item["\0*\0expiry"] ? \DateTime::createFromFormat('U.u', sprintf('%.6f', $item["\0*\0expiry"])) : null);
@@ -120,7 +120,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
if ($this->namespaceLen) {
foreach ($keys as $i => $key) {
diff --git a/vendor/symfony/cache/Adapter/TagAwareAdapter.php b/vendor/symfony/cache/Adapter/TagAwareAdapter.php
index 4144ffea74..e54044b60a 100644
--- a/vendor/symfony/cache/Adapter/TagAwareAdapter.php
+++ b/vendor/symfony/cache/Adapter/TagAwareAdapter.php
@@ -30,13 +30,13 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
use ProxyTrait;
use ContractsTrait;
- private $deferred = array();
+ private $deferred = [];
private $createCacheItem;
private $setCacheItemTags;
private $getTagsByKey;
private $invalidateTags;
private $tags;
- private $knownTagVersions = array();
+ private $knownTagVersions = [];
private $knownTagVersionsTtl;
public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null, float $knownTagVersionsTtl = 0.15)
@@ -82,9 +82,9 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
);
$this->getTagsByKey = \Closure::bind(
function ($deferred) {
- $tagsByKey = array();
+ $tagsByKey = [];
foreach ($deferred as $key => $item) {
- $tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? array();
+ $tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? [];
}
return $tagsByKey;
@@ -113,8 +113,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
public function invalidateTags(array $tags)
{
$ok = true;
- $tagsByKey = array();
- $invalidatedTags = array();
+ $tagsByKey = [];
+ $invalidatedTags = [];
foreach ($tags as $tag) {
CacheItem::validateKey($tag);
$invalidatedTags[$tag] = 0;
@@ -131,7 +131,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
$f = $this->getTagsByKey;
$tagsByKey = $f($items);
- $this->deferred = array();
+ $this->deferred = [];
}
$tagVersions = $this->getTagVersions($tagsByKey, $invalidatedTags);
@@ -165,7 +165,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
return true;
}
- foreach ($this->getTagVersions(array($itemTags)) as $tag => $version) {
+ foreach ($this->getTagVersions([$itemTags]) as $tag => $version) {
if ($itemTags[$tag] !== $version && 1 !== $itemTags[$tag] - $version) {
return false;
}
@@ -179,7 +179,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
*/
public function getItem($key)
{
- foreach ($this->getItems(array($key)) as $item) {
+ foreach ($this->getItems([$key]) as $item) {
return $item;
}
}
@@ -187,12 +187,12 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
if ($this->deferred) {
$this->commit();
}
- $tagKeys = array();
+ $tagKeys = [];
foreach ($keys as $key) {
if ('' !== $key && \is_string($key)) {
@@ -217,7 +217,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
*/
public function clear()
{
- $this->deferred = array();
+ $this->deferred = [];
return $this->pool->clear();
}
@@ -227,7 +227,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
*/
public function deleteItem($key)
{
- return $this->deleteItems(array($key));
+ return $this->deleteItems([$key]);
}
/**
@@ -275,7 +275,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
*/
public function commit()
{
- return $this->invalidateTags(array());
+ return $this->invalidateTags([]);
}
public function __destruct()
@@ -285,7 +285,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
private function generateItems($items, array $tagKeys)
{
- $bufferedItems = $itemTags = array();
+ $bufferedItems = $itemTags = [];
$f = $this->setCacheItemTags;
foreach ($items as $key => $item) {
@@ -299,7 +299,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
}
unset($tagKeys[$key]);
- $itemTags[$key] = $item->get() ?: array();
+ $itemTags[$key] = $item->get() ?: [];
if (!$tagKeys) {
$tagVersions = $this->getTagVersions($itemTags);
@@ -322,7 +322,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
}
}
- private function getTagVersions(array $tagsByKey, array &$invalidatedTags = array())
+ private function getTagVersions(array $tagsByKey, array &$invalidatedTags = [])
{
$tagVersions = $invalidatedTags;
@@ -331,7 +331,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
}
if (!$tagVersions) {
- return array();
+ return [];
}
if (!$fetchTagVersions = 1 !== \func_num_args()) {
@@ -345,7 +345,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
}
$now = microtime(true);
- $tags = array();
+ $tags = [];
foreach ($tagVersions as $tag => $version) {
$tags[$tag.static::TAGS_PREFIX] = $tag;
if ($fetchTagVersions || !isset($this->knownTagVersions[$tag])) {
@@ -370,7 +370,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
if (isset($invalidatedTags[$tag])) {
$invalidatedTags[$tag] = $version->set(++$tagVersions[$tag]);
}
- $this->knownTagVersions[$tag] = array($now, $tagVersions[$tag]);
+ $this->knownTagVersions[$tag] = [$now, $tagVersions[$tag]];
}
return $tagVersions;
diff --git a/vendor/symfony/cache/Adapter/TraceableAdapter.php b/vendor/symfony/cache/Adapter/TraceableAdapter.php
index e1d96bb4ef..5c294d03fd 100644
--- a/vendor/symfony/cache/Adapter/TraceableAdapter.php
+++ b/vendor/symfony/cache/Adapter/TraceableAdapter.php
@@ -28,7 +28,7 @@ use Symfony\Contracts\Service\ResetInterface;
class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface
{
protected $pool;
- private $calls = array();
+ private $calls = [];
public function __construct(AdapterInterface $pool)
{
@@ -142,7 +142,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
/**
* {@inheritdoc}
*/
- public function getItems(array $keys = array())
+ public function getItems(array $keys = [])
{
$event = $this->start(__FUNCTION__);
try {
@@ -151,7 +151,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
$event->end = microtime(true);
}
$f = function () use ($result, $event) {
- $event->result = array();
+ $event->result = [];
foreach ($result as $key => $item) {
if ($event->result[$key] = $item->isHit()) {
++$event->hits;
@@ -257,7 +257,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt
public function clearCalls()
{
- $this->calls = array();
+ $this->calls = [];
}
protected function start($name)