Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cache] fix warning on PHP 7.4 #32796

Merged
merged 1 commit into from Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
Expand Up @@ -49,7 +49,7 @@ protected function __construct($namespace = '', $defaultLifetime = 0)
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
}
$this->createCacheItem = \Closure::bind(
function ($key, $value, $isHit) use ($defaultLifetime) {
static function ($key, $value, $isHit) use ($defaultLifetime) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
Expand All @@ -63,7 +63,7 @@ function ($key, $value, $isHit) use ($defaultLifetime) {
);
$getId = function ($key) { return $this->getId((string) $key); };
$this->mergeByLifetime = \Closure::bind(
function ($deferred, $namespace, &$expiredIds) use ($getId) {
static function ($deferred, $namespace, &$expiredIds) use ($getId) {
$byLifetime = [];
$now = time();
$expiredIds = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
Expand Up @@ -34,7 +34,7 @@ public function __construct($defaultLifetime = 0, $storeSerialized = true)
{
$this->storeSerialized = $storeSerialized;
$this->createCacheItem = \Closure::bind(
function ($key, $value, $isHit) use ($defaultLifetime) {
static function ($key, $value, $isHit) use ($defaultLifetime) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/ChainAdapter.php
Expand Up @@ -56,7 +56,7 @@ public function __construct(array $adapters, $defaultLifetime = 0)
$this->adapterCount = \count($this->adapters);

$this->syncItem = \Closure::bind(
function ($sourceItem, $item) use ($defaultLifetime) {
static function ($sourceItem, $item) use ($defaultLifetime) {
$item->value = $sourceItem->value;
$item->expiry = $sourceItem->expiry;
$item->isHit = $sourceItem->isHit;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
Expand Up @@ -42,7 +42,7 @@ public function __construct($file, AdapterInterface $fallbackPool)
$this->pool = $fallbackPool;
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN);
$this->createCacheItem = \Closure::bind(
function ($key, $value, $isHit) {
static function ($key, $value, $isHit) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
Expand Up @@ -42,7 +42,7 @@ public function __construct(CacheItemPoolInterface $pool, $namespace = '', $defa
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
$this->namespaceLen = \strlen($namespace);
$this->createCacheItem = \Closure::bind(
function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
static function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
$item = new CacheItem();
$item->key = $key;
$item->defaultLifetime = $defaultLifetime;
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
Expand Up @@ -42,7 +42,7 @@ public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsP
$this->tags = $tagsPool ?: $itemsPool;
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
$this->createCacheItem = \Closure::bind(
function ($key, $value, CacheItem $protoItem) {
static function ($key, $value, CacheItem $protoItem) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
Expand All @@ -56,7 +56,7 @@ function ($key, $value, CacheItem $protoItem) {
CacheItem::class
);
$this->setCacheItemTags = \Closure::bind(
function (CacheItem $item, $key, array &$itemTags) {
static function (CacheItem $item, $key, array &$itemTags) {
if (!$item->isHit) {
return $item;
}
Expand All @@ -76,7 +76,7 @@ function (CacheItem $item, $key, array &$itemTags) {
CacheItem::class
);
$this->getTagsByKey = \Closure::bind(
function ($deferred) {
static function ($deferred) {
$tagsByKey = [];
foreach ($deferred as $key => $item) {
$tagsByKey[$key] = $item->tags;
Expand All @@ -88,7 +88,7 @@ function ($deferred) {
CacheItem::class
);
$this->invalidateTags = \Closure::bind(
function (AdapterInterface $tagsAdapter, array $tags) {
static function (AdapterInterface $tagsAdapter, array $tags) {
foreach ($tags as $v) {
$v->defaultLifetime = 0;
$v->expiry = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Simple/Psr6Cache.php
Expand Up @@ -41,7 +41,7 @@ public function __construct(CacheItemPoolInterface $pool)
}
$cacheItemPrototype = &$this->cacheItemPrototype;
$createCacheItem = \Closure::bind(
function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
$item = clone $cacheItemPrototype;
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
$item->value = $value;
Expand Down
Expand Up @@ -30,7 +30,7 @@ public function __construct(ParserCacheInterface $pool)
$this->pool = $pool;

$this->createCacheItem = \Closure::bind(
function ($key, $value, $isHit) {
static function ($key, $value, $isHit) {
$item = new CacheItem();
$item->key = $key;
$item->value = $value;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Loader/PhpFileLoader.php
Expand Up @@ -40,7 +40,7 @@ public function load($file, $type = null)

// the closure forbids access to the private scope in the included file
$loader = $this;
$load = \Closure::bind(function ($file) use ($loader) {
$load = \Closure::bind(static function ($file) use ($loader) {
return include $file;
}, null, ProtectedPhpFileLoader::class);

Expand Down