Skip to content

Commit f43aac3

Browse files
author
André R
committed
Add compatability for Symfony\Contracts\EventDispatcher\Event
1 parent ded7817 commit f43aac3

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

src/BaseEvent.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the FOSHttpCache package.
5+
*
6+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace FOS\HttpCache;
13+
14+
use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
15+
use Symfony\Component\EventDispatcher\Event as OldEvent;
16+
17+
if (class_exists(ContractEvent::class)) {
18+
class BaseEvent extends ContractEvent
19+
{
20+
}
21+
} else {
22+
/**
23+
* @codeCoverageIgnore
24+
* @ignore This is purely for 3.4 comparability.
25+
*/
26+
class BaseEvent extends OldEvent
27+
{
28+
}
29+
}

src/Event.php

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

1212
namespace FOS\HttpCache;
1313

14-
use Symfony\Component\EventDispatcher\Event as BaseEvent;
15-
1614
class Event extends BaseEvent
1715
{
1816
private $exception;

src/SymfonyCache/CacheEvent.php

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

1212
namespace FOS\HttpCache\SymfonyCache;
1313

14-
use Symfony\Component\EventDispatcher\Event;
14+
use FOS\HttpCache\BaseEvent;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpKernel\HttpKernelInterface;
@@ -21,7 +21,7 @@
2121
*
2222
* @author David Buchmann <[email protected]>
2323
*/
24-
class CacheEvent extends Event
24+
class CacheEvent extends BaseEvent
2525
{
2626
/**
2727
* @var CacheInvalidation

0 commit comments

Comments
 (0)