Skip to content

Commit affeaed

Browse files
committed
Clean up annoying 5.3 $that = $this
1 parent 20cc045 commit affeaed

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

Stream.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ public function __construct($stream, LoopInterface $loop)
2121
$this->loop = $loop;
2222
$this->buffer = new Buffer($this->stream, $this->loop);
2323

24-
$that = $this;
25-
26-
$this->buffer->on('error', function ($error) use ($that) {
27-
$that->emit('error', array($error, $that));
28-
$that->close();
24+
$this->buffer->on('error', function ($error) {
25+
$this->emit('error', array($error, $this));
26+
$this->close();
2927
});
3028

31-
$this->buffer->on('drain', function () use ($that) {
32-
$that->emit('drain');
29+
$this->buffer->on('drain', function () {
30+
$this->emit('drain');
3331
});
3432

3533
$this->resume();
@@ -95,10 +93,8 @@ public function end($data = null)
9593
$this->readable = false;
9694
$this->writable = false;
9795

98-
$that = $this;
99-
100-
$this->buffer->on('close', function () use ($that) {
101-
$that->close();
96+
$this->buffer->on('close', function () {
97+
$this->close();
10298
});
10399

104100
$this->buffer->end($data);

0 commit comments

Comments
 (0)