diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 0868c16d47cf..b543371159df 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -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; @@ -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 = []; diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index 858a47e9ab1a..4c6695e267de 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -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; diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php index 1f4d319e4f9a..0080db711bce 100644 --- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php @@ -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; diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index 42a414209938..59994ea4b6a2 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -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; diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php index 0b7918287e90..009e92fb88e0 100644 --- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php @@ -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; diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 362aceed0eb1..433d4eb132b1 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -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; @@ -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; } @@ -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; @@ -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; diff --git a/src/Symfony/Component/Cache/Simple/Psr6Cache.php b/src/Symfony/Component/Cache/Simple/Psr6Cache.php index 85d75becbe58..aab41f722db0 100644 --- a/src/Symfony/Component/Cache/Simple/Psr6Cache.php +++ b/src/Symfony/Component/Cache/Simple/Psr6Cache.php @@ -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; diff --git a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php index 30d9f8425b98..38ce6590b94b 100644 --- a/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php +++ b/src/Symfony/Component/ExpressionLanguage/ParserCache/ParserCacheAdapter.php @@ -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; diff --git a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php index d81e7e82e7db..d9ba59d51e03 100644 --- a/src/Symfony/Component/Routing/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/PhpFileLoader.php @@ -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);