Skip to content

Commit 8a0aae0

Browse files
committed
Let's support legacy PHP 5.3, again..
1 parent 411bdbc commit 8a0aae0

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: php
22

33
php:
4+
- 5.3
45
- 5.4
56
- 5.5
67
- 5.6

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"keywords": ["process"],
55
"license": "MIT",
66
"require": {
7-
"php": ">=5.4.0",
8-
"evenement/evenement": "~2.0",
9-
"react/event-loop": "0.4.*",
7+
"php": ">=5.3.0",
8+
"evenement/evenement": "^2.0 || ^1.0",
9+
"react/event-loop": "^0.4 || ^0.3",
1010
"react/stream": "~0.4.2"
1111
},
1212
"require-dev": {

src/Process.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,21 @@ public function start(LoopInterface $loop, $interval = 0.1)
103103

104104
$closeCount = 0;
105105

106-
$streamCloseHandler = function (Stream $stream) use (&$closeCount, $loop, $interval) {
106+
$that = $this;
107+
$streamCloseHandler = function (Stream $stream) use (&$closeCount, $loop, $interval, $that) {
107108
$closeCount++;
108109

109110
if ($closeCount < 2) {
110111
return;
111112
}
112113

113-
$loop->addPeriodicTimer($interval, function (TimerInterface $timer) {
114-
if (!$this->isRunning()) {
115-
$this->close();
114+
$loop->addPeriodicTimer($interval, function (TimerInterface $timer) use ($that) {
115+
if (!$that->isRunning()) {
116+
$that->close();
116117
$timer->cancel();
117-
$this->emit('exit', array($this->getExitCode(), $this->getTermSignal()));
118+
$that->emit('exit', array($that->getExitCode(), $that->getTermSignal()));
118119
}
119120
});
120-
121121
};
122122

123123
$this->stdin = new Stream($this->pipes[0], $loop);

tests/AbstractProcessTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,21 +268,22 @@ public function testTerminateWithStopAndContinueSignalsUsingEventLoop()
268268
$termSignal = func_get_arg(1);
269269
});
270270

271-
$loop->addTimer(0.001, function(Timer $timer) use ($process) {
271+
$that = $this;
272+
$loop->addTimer(0.001, function(Timer $timer) use ($process, $that) {
272273
$process->start($timer->getLoop());
273274
$process->terminate(SIGSTOP);
274275

275-
$this->assertSoon(function() use ($process) {
276-
$this->assertTrue($process->isStopped());
277-
$this->assertTrue($process->isRunning());
278-
$this->assertEquals(SIGSTOP, $process->getStopSignal());
276+
$that->assertSoon(function() use ($process, $that) {
277+
$that->assertTrue($process->isStopped());
278+
$that->assertTrue($process->isRunning());
279+
$that->assertEquals(SIGSTOP, $process->getStopSignal());
279280
});
280281

281282
$process->terminate(SIGCONT);
282283

283-
$this->assertSoon(function() use ($process) {
284-
$this->assertFalse($process->isStopped());
285-
$this->assertEquals(SIGSTOP, $process->getStopSignal());
284+
$that->assertSoon(function() use ($process, $that) {
285+
$that->assertFalse($process->isStopped());
286+
$that->assertEquals(SIGSTOP, $process->getStopSignal());
286287
});
287288
});
288289

0 commit comments

Comments
 (0)