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:
parent
30f1ab494a
commit
c024ff7c1d
@ -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";
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user