1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-01-17 21:38:16 +01:00

Removing emitter discrepancy. Closes #981

This commit is contained in:
Michael Dowling 2015-04-25 11:55:50 -07:00
parent 30f1ab494a
commit c024ff7c1d
2 changed files with 3 additions and 7 deletions

View File

@ -103,11 +103,7 @@ follows:
use GuzzleHttp\Event\BeforeEvent;
$emitter->on('before', function (
BeforeEvent $event,
$name,
EmitterInterface $emitter
) {
$emitter->on('before', function (BeforeEvent $event, $name) {
echo $event->getRequest();
});
@ -334,7 +330,7 @@ a ``GuzzleHttp\Event\BeforeEvent``.
$request = $client->createRequest('GET', '/');
$request->getEmitter()->on(
'before',
function (BeforeEvent $e, $name, EmitterInterface $emitter) {
function (BeforeEvent $e, $name) {
echo $name . "\n";
// "before"
echo $e->getRequest()->getMethod() . "\n";

View File

@ -47,7 +47,7 @@ class Emitter implements EmitterInterface
$eventName
) use (&$onceListener, $eventName, $listener, $priority) {
$this->removeListener($eventName, $onceListener);
$listener($event, $eventName, $this);
$listener($event, $eventName);
};
$this->on($eventName, $onceListener, $priority);