diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 0868c16d47..b543371159 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -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)); } $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; @@ -63,7 +63,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface ); $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 = []; diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index 858a47e9ab..4c6695e267 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -34,7 +34,7 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable { $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; diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php index 1f4d319e4f..0080db711b 100644 --- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php @@ -56,7 +56,7 @@ class ChainAdapter implements AdapterInterface, PruneableInterface, ResettableIn $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; diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index 42a4142099..59994ea4b6 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -42,7 +42,7 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl $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; diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php index 0b7918287e..009e92fb88 100644 --- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php @@ -42,7 +42,7 @@ class ProxyAdapter implements AdapterInterface, PruneableInterface, ResettableIn $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; diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 362aceed0e..433d4eb132 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -42,7 +42,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R $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; @@ -56,7 +56,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R CacheItem::class ); $this->setCacheItemTags = \Closure::bind( - function (CacheItem $item, $key, array &$itemTags) { + static function (CacheItem $item, $key, array &$itemTags) { if (!$item->isHit) { return $item; } @@ -76,7 +76,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R CacheItem::class ); $this->getTagsByKey = \Closure::bind( - function ($deferred) { + static function ($deferred) { $tagsByKey = []; foreach ($deferred as $key => $item) { $tagsByKey[$key] = $item->tags; @@ -88,7 +88,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, PruneableInterface, R 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; diff --git a/src/Symfony/Component/Cache/Simple/Psr6Cache.php b/src/Symfony/Component/Cache/Simple/Psr6Cache.php index 85d75becbe..aab41f722d 100644 --- a/src/Symfony/Component/Cache/Simple/Psr6Cache.php +++ b/src/Symfony/Component/Cache/Simple/Psr6Cache.php @@ -41,7 +41,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa } $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; diff --git a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php index 30d9f8425b..38ce6590b9 100644 --- a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php +++ b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php @@ -30,7 +30,7 @@ class ParserCacheAdapter implements CacheItemPoolInterface $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; diff --git a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php index d81e7e82e7..d9ba59d51e 100644 --- a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php @@ -40,7 +40,7 @@ class PhpFileLoader extends FileLoader // 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);