Fixes wrong exception in ChainCache

This commit is contained in:
Matias Griese
2018-01-19 11:49:01 +02:00
parent 827b4e5d75
commit c473c0baaf
2 changed files with 5 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ namespace Grav\Framework\Cache\Adapter;
use Grav\Framework\Cache\AbstractCache;
use Grav\Framework\Cache\CacheInterface;
use Grav\Framework\Cache\Exception\InvalidArgumentException;
/**
* Cache class for PSR-16 compatible "Simple Cache" implementation using chained cache adapters.
@@ -32,19 +33,19 @@ class ChainCache extends AbstractCache
* Chain Cache constructor.
* @param array $caches
* @param null|int|\DateInterval $defaultLifetime
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
public function __construct(array $caches, $defaultLifetime = null)
{
parent::__construct('', $defaultLifetime);
if (!$caches) {
throw new \InvalidArgumentException('At least one cache must be specified');
throw new InvalidArgumentException('At least one cache must be specified');
}
foreach ($caches as $cache) {
if (!$cache instanceof CacheInterface) {
throw new \InvalidArgumentException(
throw new InvalidArgumentException(
sprintf(
"The class '%s' does not implement the '%s' interface",
get_class($cache),

View File

@@ -194,6 +194,7 @@ class FileCache extends AbstractCache
/**
* @internal
* @throws \ErrorException
*/
public static function throwError($type, $message, $file, $line)
{