8000 [Cache] fix warning on PHP 7.4 · symfony/symfony@3324505 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3324505

Browse files
Julien Paulinicolas-grekas
Julien Pauli
authored andcommitted
[Cache] fix warning on PHP 7.4
1 parent 3f43186 commit 3324505

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function __construct($namespace = '', $defaultLifetime = 0)
4949
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
5050
}
5151
$this->createCacheItem = \Closure::bind(
52-
function ($key, $value, $isHit) use ($defaultLifetime) {
52+
static function ($key, $value, $isHit) use ($defaultLifetime) {
5353
$item = new CacheItem();
5454
$item->key = $key;
5555
$item->value = $value;
@@ -63,7 +63,7 @@ function ($key, $value, $isHit) use ($defaultLifetime) {
6363
);
6464
$getId = function ($key) { return $this->getId((string) $key); };
6565
$this->mergeByLifetime = \Closure::bind(
66-
function ($deferred, $namespace, &$expiredIds) use ($getId) {
66+
static function ($deferred, $namespace, &$expiredIds) use ($getId) {
6767
$byLifetime = [];
6868
$now = time();
6969
$expiredIds = [];

src/Symfony/Component/Cache/Adapter/ArrayAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct($defaultLifetime = 0, $storeSerialized = true)
3434
{
3535
$this->storeSerialized = $storeSerialized;
3636
$this->createCacheItem = \Closure::bind(
37-
function ($key, $value, $isHit) use ($defaultLifetime) {
37+
static function ($key, $value, $isHit) use ($defaultLifetime) {
3838
$item = new CacheItem();
3939
$item->key = $key;
4040
$item->value = $value;

src/Symfony/Component/Cache/Adapter/ChainAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(array $adapters, $defaultLifetime = 0)
5656
$this->adapterCount = \count($this->adapters);
5757

5858
$this->syncItem = \Closure::bind(
59-
function ($sourceItem, $item) use ($defaultLifetime) {
59+
static function ($sourceItem, $item) use ($defaultLifetime) {
6060
$item->value = $sourceItem->value;
6161
$item->expiry = $sourceItem->expiry;
6262
$item->isHit = $sourceItem->isHit;

src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($file, AdapterInterface $fallbackPool)
4242
$this-& ED4F gt;pool = $fallbackPool;
4343
$this->zendDetectUnicode = filter_var(ini_get('zend.detect_unicode'), FILTER_VALIDATE_BOOLEAN);
4444
$this->createCacheItem = \Closure::bind(
45-
function ($key, $value, $isHit) {
45+
static function ($key, $value, $isHit) {
4646
$item = new CacheItem();
4747
$item->key = $key;
4848
$item->value = $value;

src/Symfony/Component/Cache/Adapter/ProxyAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(CacheItemPoolInterface $pool, $namespace = '', $defa
4242
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
4343
$this->namespaceLen = \strlen($namespace);
4444
$this->createCacheItem = \Closure::bind(
45-
function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
45+
static function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
4646
$item = new CacheItem();
4747
$item->key = $key;
4848
$item->defaultLifetime = $defaultLifetime;

src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsP
4242
$this->tags = $tagsPool ?: $itemsPool;
4343
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
4444
$this->createCacheItem = \Closure::bind(
45-
function ($key, $value, CacheItem $protoItem) {
45+
static function ($key, $value, CacheItem $protoItem) {
4646
$item = new CacheItem();
4747
$item->key = $key;
4848
$item->value = $value;
@@ -56,7 +56,7 @@ function ($key, $value, CacheItem $protoItem) {
5656
CacheItem::class
5757
);
5858
$this->setCacheItemTags = \Closure::bind(
59-
function (CacheItem $item, $key, array &$itemTags) {
59+
static function (CacheItem $item, $key, array &$itemTags) {
6060
if (!$item->isHit) {
6161
return $item;
6262
}
@@ -76,7 +76,7 @@ function (CacheItem $item, $key, array &$itemTags) {
7676
CacheItem::class
7777
);
7878
$this->getTagsByKey = \Closure::bind(
79-
function ($deferred) {
79+
static function ($deferred) {
8080
$tagsByKey = [];
8181
foreach ($deferred as $key => $item) {
8282
$tagsByKey[$key] = $item->tags;
@@ -88,7 +88,7 @@ function ($deferred) {
8888
CacheItem::class
8989
);
9090
$this->invalidateTags = \Closure::bind(
91-
function (AdapterInterface $tagsAdapter, array $tags) {
91+
static function (AdapterInterface $tagsAdapter, array $tags) {
9292
foreach ($tags as $v) {
9393
$v->defaultLifetime = 0;
9494
$v->expiry = null;

src/Symfony/Component/Cache/Simple/Psr6Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(CacheItemPoolInterface $pool)
4141
}
4242
$cacheItemPrototype = &$this->cacheItemPrototype;
4343
$createCacheItem = \Closure::bind(
44-
function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
44+
static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
4545
$item = clone $cacheItemPrototype;
4646
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
4747
$item->value = $value;

src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(ParserCacheInterface $pool)
3030
$this->pool = $pool;
3131

3232
$this->createCacheItem = \Closure::bind(
33-
function ($key, $value, $isHit) {
33+
static function ($key, $value, $isHit) {
3434
$item = new CacheItem();
3535
$item->key = $key;
3636
$item->value = $value;

src/Symfony/Component/Routing/Loader/PhpFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function load($file, $type = null)
4040

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

0 commit comments

Comments
 (0)
0