Skip to content

Commit

Permalink
Fixes wrong exception in ChainCache
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Jan 19, 2018
1 parent 827b4e5 commit c473c0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions system/src/Grav/Framework/Cache/Adapter/ChainCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

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.
Expand All @@ -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),
Expand Down
1 change: 1 addition & 0 deletions system/src/Grav/Framework/Cache/Adapter/FileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private function write($file, $data, $expiresAt = null)

/**
* @internal
* @throws \ErrorException
*/
public static function throwError($type, $message, $file, $line)
{
Expand Down

0 comments on commit c473c0b

Please sign in to comment.