8000 Throw exception if incompatible version of psr/simple-cache is used · symfony/symfony@f725fe7 · GitHub
[go: up one dir, main page]

Skip to content

Commit f725fe7

Browse files
committed
Throw exception if incompatible version of psr/simple-cache is used
1 parent b8656d4 commit f725fe7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Component/Cache/Psr16Cache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Cache;
1313

14+
use Composer\InstalledVersions;
1415
use Psr\Cache\CacheException as Psr6CacheException;
1516
use Psr\Cache\CacheItemPoolInterface;
1617
use Psr\SimpleCache\CacheException as SimpleCacheException;
@@ -19,6 +20,12 @@
1920
use Symfony\Component\Cache\Exception\InvalidArgumentException;
2021
use Symfony\Component\Cache\Traits\ProxyTrait;
2122

23+
if (class_exists(InstalledVersions::class) && InstalledVersions::isInstalled('psr/simple-cache')) {
24+
if (version_compare(InstalledVersions::getVersion('psr/simple-cache'), '3.0.0', '>=')) {
25+
throw new \RuntimeException(sprintf('psr/simple-cache "%s" is not compatible with this version of symfony/cache. Please upgrade symfony/cache to 6.0+ or downgrade psr/simple-cache to v1.x or 2.x.', InstalledVersions::getPrettyVersion('psr/simple-cache')));
26+
}
27+
}
28+
2229
/**
2330
* Turns a PSR-6 cache into a PSR-16 one.
2431
*

0 commit comments

Comments
 (0)
0