Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -18,29 +18,40 @@ use Psr\Cache\CacheItemPoolInterface;
*/
class Psr6CacheClearer implements CacheClearerInterface
{
private $pools = array();
private array $pools = [];
public function __construct(array $pools = array())
/**
* @param array<string, CacheItemPoolInterface> $pools
*/
public function __construct(array $pools = [])
{
$this->pools = $pools;
}
public function addPool(CacheItemPoolInterface $pool)
{
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Pass an array of pools indexed by name to the constructor instead.', __METHOD__), E_USER_DEPRECATED);
$this->pools[] = $pool;
}
public function hasPool($name)
public function hasPool(string $name): bool
{
return isset($this->pools[$name]);
}
public function clearPool($name)
/**
* @throws \InvalidArgumentException If the cache pool with the given name does not exist
*/
public function getPool(string $name): CacheItemPoolInterface
{
if (!$this->hasPool($name)) {
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
}
return $this->pools[$name];
}
/**
* @throws \InvalidArgumentException If the cache pool with the given name does not exist
*/
public function clearPool(string $name): bool
{
if (!isset($this->pools[$name])) {
throw new \InvalidArgumentException(sprintf('Cache pool not found: %s.', $name));
throw new \InvalidArgumentException(sprintf('Cache pool not found: "%s".', $name));
}
return $this->pools[$name]->clear();
@@ -49,7 +60,7 @@ class Psr6CacheClearer implements CacheClearerInterface
/**
* {@inheritdoc}
*/
public function clear($cacheDir)
public function clear(string $cacheDir)
{
foreach ($this->pools as $pool) {
$pool->clear();