Fix compatibility with sf event dispatcher ^4.3.

This commit is contained in:
Stanislav Aliferovich
2019-12-22 14:22:55 +03:00
parent cc3257181c
commit e12f08132f
4 changed files with 9 additions and 12 deletions
-8
View File
@@ -3,10 +3,6 @@ dist: trusty
sudo: false
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
@@ -17,10 +13,6 @@ cache:
matrix:
fast_finish: true
include:
- php: 5.3
dist: precise
env: COMPOSER_FLAGS="--prefer-lowest"
before_script:
- phpenv config-rm xdebug.ini
+2 -2
View File
@@ -9,8 +9,8 @@
{ "name": "Jeremy Mikola", "email": "jmikola@gmail.com" }
],
"require": {
"php": ">=5.3.2",
"symfony/event-dispatcher": "^2.3 || ^3.0 || ^4.0"
"php": ">=7.1.3",
"symfony/event-dispatcher": "^4.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^6.4"
@@ -33,7 +33,11 @@ class WildcardEventDispatcher implements EventDispatcherInterface
{
$this->bindPatterns($eventName);
return $this->dispatcher->dispatch($eventName, $event);
if ($event === null) {
$event = new Event();
}
return $this->dispatcher->dispatch($event, $eventName);
}
/**
@@ -3,6 +3,7 @@
namespace Jmikola\Tests\WildcardEventDispatcher;
use Jmikola\WildcardEventDispatcher\WildcardEventDispatcher;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use PHPUnit\Framework\TestCase;
@@ -66,7 +67,7 @@ class EventDispatcherTest extends TestCase
$this->innerDispatcher->expects($this->once())
->after('listener-is-added')
->method('dispatch')
->with('core.request');
->with(new Event(), 'core.request');
$this->dispatcher->addListener('core.*', 'callback', 0);
$this->dispatcher->dispatch('core.request');