mirror of
https://github.com/guzzle/guzzle.git
synced 2025-01-18 05:48:15 +01:00
Removing emitter discrepancy. Closes #981
This commit is contained in:
parent
30f1ab494a
commit
c024ff7c1d
@ -103,11 +103,7 @@ follows:
|
|||||||
|
|
||||||
use GuzzleHttp\Event\BeforeEvent;
|
use GuzzleHttp\Event\BeforeEvent;
|
||||||
|
|
||||||
$emitter->on('before', function (
|
$emitter->on('before', function (BeforeEvent $event, $name) {
|
||||||
BeforeEvent $event,
|
|
||||||
$name,
|
|
||||||
EmitterInterface $emitter
|
|
||||||
) {
|
|
||||||
echo $event->getRequest();
|
echo $event->getRequest();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -334,7 +330,7 @@ a ``GuzzleHttp\Event\BeforeEvent``.
|
|||||||
$request = $client->createRequest('GET', '/');
|
$request = $client->createRequest('GET', '/');
|
||||||
$request->getEmitter()->on(
|
$request->getEmitter()->on(
|
||||||
'before',
|
'before',
|
||||||
function (BeforeEvent $e, $name, EmitterInterface $emitter) {
|
function (BeforeEvent $e, $name) {
|
||||||
echo $name . "\n";
|
echo $name . "\n";
|
||||||
// "before"
|
// "before"
|
||||||
echo $e->getRequest()->getMethod() . "\n";
|
echo $e->getRequest()->getMethod() . "\n";
|
||||||
|
@ -47,7 +47,7 @@ class Emitter implements EmitterInterface
|
|||||||
$eventName
|
$eventName
|
||||||
) use (&$onceListener, $eventName, $listener, $priority) {
|
) use (&$onceListener, $eventName, $listener, $priority) {
|
||||||
$this->removeListener($eventName, $onceListener);
|
$this->removeListener($eventName, $onceListener);
|
||||||
$listener($event, $eventName, $this);
|
$listener($event, $eventName);
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->on($eventName, $onceListener, $priority);
|
$this->on($eventName, $onceListener, $priority);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user