File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1111
1212namespace FOS \HttpCache \SymfonyCache ;
1313
14+ use Symfony \Component \HttpKernel \Kernel ;
1415use Symfony \Component \HttpKernel \HttpKernelInterface ;
1516
1617use function class_alias ;
1718use function class_exists ;
1819
19- if (! interface_exists (CacheInvalidation::class) &&
20- class_exists ('Symfony\Component\HttpKernel\Kernel ' ) &&
21- \Symfony \Component \HttpKernel \Kernel::MAJOR_VERSION >= 6 ) {
20+ if (interface_exists (CacheInvalidation::class)) {
21+ return ;
22+ }
23+
24+ /*
25+ * Symfony 6 introduced a BC break in the signature of the protected method HttpKernelInterface::fetch.
26+ * Load the correct interface to match the signature.
27+ */
28+ if (class_exists (Kernel::class) && Kernel::MAJOR_VERSION >= 6 ) {
2229 // Load class for Symfony >=6.0
2330 class_alias (
2431 Compatibility \CacheInvalidationS6::class,
Original file line number Diff line number Diff line change 1818
1919/**
2020 * Interface for a HttpCache that supports active cache invalidation.
21+ *
22+ * Method signature of `fetch` and `getStore` compatible with Symfony 5 and older.
2123 */
2224interface CacheInvalidationLegacy extends HttpKernelInterface
2325{
Original file line number Diff line number Diff line change 1818
1919/**
2020 * Interface for a HttpCache that supports active cache invalidation.
21+ *
22+ * Method signature of `fetch` and `getStore` compatible with Symfony 6 or newer.
2123 */
2224interface CacheInvalidationS6 extends HttpKernelInterface
2325{
You can’t perform that action at this time.
0 commit comments