[Cache] fix warning on PHP 7.4
This commit is contained in:
parent
3f431860c6
commit
3324505b51
@ -49,7 +49,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
|||||||
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
||||||
}
|
}
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
@ -63,7 +63,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
|||||||
);
|
);
|
||||||
$getId = function ($key) { return $this->getId((string) $key); };
|
$getId = function ($key) { return $this->getId((string) $key); };
|
||||||
$this->mergeByLifetime = \Closure::bind(
|
$this->mergeByLifetime = \Closure::bind(
|
||||||
function ($deferred, $namespace, &$expiredIds) use ($getId) {
|
static function ($deferred, $namespace, &$expiredIds) use ($getId) {
|
||||||
$byLifetime = [];
|
$byLifetime = [];
|
||||||
$now = time();
|
$now = time();
|
||||||
$expiredIds = [];
|
$expiredIds = [];
|
||||||
|
@ -34,7 +34,7 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
|
|||||||
{
|
{
|
||||||
$this->storeSerialized = $storeSerialized;
|
$this->storeSerialized = $storeSerialized;
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
|
@ -56,7 +56,7 @@ class ChainAdapter implements AdapterInterface, PruneableInterface, ResettableIn
|
|||||||
$this->adapterCount = \count($this->adapters);
|
$this->adapterCount = \count($this->adapters);
|
||||||
|
|
||||||
$this->syncItem = \Closure::bind(
|
$this->syncItem = \Closure::bind(
|
||||||
function ($sourceItem, $item) use ($defaultLifetime) {
|
static function ($sourceItem, $item) use ($defaultLifetime) {
|
||||||
$item->value = $sourceItem->value;
|
$item->value = $sourceItem->value;
|
||||||
$item->expiry = $sourceItem->expiry;
|
$item->expiry = $sourceItem->expiry;
|
||||||
$item->isHit = $sourceItem->isHit;
|
$item->isHit = $sourceItem->isHit;
|
||||||
|
@ -42,7 +42,7 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl
|
|||||||
$this->pool = $fallbackPool;
|
$this->pool = $fallbackPool;
|
||||||
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN);
|
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN);
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $isHit) {
|
static function ($key, $value, $isHit) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
|
@ -42,7 +42,7 @@ class ProxyAdapter implements AdapterInterface, PruneableInterface, ResettableIn
|
|||||||
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
|
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
|
||||||
$this->namespaceLen = \strlen($namespace);
|
$this->namespaceLen = \strlen($namespace);
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
|
static function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->defaultLifetime = $defaultLifetime;
|
$item->defaultLifetime = $defaultLifetime;
|
||||||
|
@ -42,7 +42,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
|
|||||||
$this->tags = $tagsPool ?: $itemsPool;
|
$this->tags = $tagsPool ?: $itemsPool;
|
||||||
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
|
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, CacheItem $protoItem) {
|
static function ($key, $value, CacheItem $protoItem) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
@ -56,7 +56,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
|
|||||||
CacheItem::class
|
CacheItem::class
|
||||||
);
|
);
|
||||||
$this->setCacheItemTags = \Closure::bind(
|
$this->setCacheItemTags = \Closure::bind(
|
||||||
function (CacheItem $item, $key, array &$itemTags) {
|
static function (CacheItem $item, $key, array &$itemTags) {
|
||||||
if (!$item->isHit) {
|
if (!$item->isHit) {
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
|
|||||||
CacheItem::class
|
CacheItem::class
|
||||||
);
|
);
|
||||||
$this->getTagsByKey = \Closure::bind(
|
$this->getTagsByKey = \Closure::bind(
|
||||||
function ($deferred) {
|
static function ($deferred) {
|
||||||
$tagsByKey = [];
|
$tagsByKey = [];
|
||||||
foreach ($deferred as $key => $item) {
|
foreach ($deferred as $key => $item) {
|
||||||
$tagsByKey[$key] = $item->tags;
|
$tagsByKey[$key] = $item->tags;
|
||||||
@ -88,7 +88,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R
|
|||||||
CacheItem::class
|
CacheItem::class
|
||||||
);
|
);
|
||||||
$this->invalidateTags = \Closure::bind(
|
$this->invalidateTags = \Closure::bind(
|
||||||
function (AdapterInterface $tagsAdapter, array $tags) {
|
static function (AdapterInterface $tagsAdapter, array $tags) {
|
||||||
foreach ($tags as $v) {
|
foreach ($tags as $v) {
|
||||||
$v->defaultLifetime = 0;
|
$v->defaultLifetime = 0;
|
||||||
$v->expiry = null;
|
$v->expiry = null;
|
||||||
|
@ -41,7 +41,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa
|
|||||||
}
|
}
|
||||||
$cacheItemPrototype = &$this->cacheItemPrototype;
|
$cacheItemPrototype = &$this->cacheItemPrototype;
|
||||||
$createCacheItem = \Closure::bind(
|
$createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
|
static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
|
||||||
$item = clone $cacheItemPrototype;
|
$item = clone $cacheItemPrototype;
|
||||||
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
|
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
|
@ -30,7 +30,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface
|
|||||||
$this->pool = $pool;
|
$this->pool = $pool;
|
||||||
|
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $isHit) {
|
static function ($key, $value, $isHit) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
|
@ -40,7 +40,7 @@ class PhpFileLoader extends FileLoader
|
|||||||
|
|
||||||
// the closure forbids access to the private scope in the included file
|
// the closure forbids access to the private scope in the included file
|
||||||
$loader = $this;
|
$loader = $this;
|
||||||
$load = \Closure::bind(function ($file) use ($loader) {
|
$load = \Closure::bind(static function ($file) use ($loader) {
|
||||||
return include $file;
|
return include $file;
|
||||||
}, null, ProtectedPhpFileLoader::class);
|
}, null, ProtectedPhpFileLoader::class);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user