diff --git a/lib/Internal/Producer.php b/lib/Internal/Producer.php index fdd51b5..e1656c7 100644 --- a/lib/Internal/Producer.php +++ b/lib/Internal/Producer.php @@ -124,7 +124,6 @@ trait Producer { return $deferred->promise(); } - /** * Resolves the stream with the given value. * diff --git a/lib/Loop/UvDriver.php b/lib/Loop/UvDriver.php index 1be8001..01ba592 100644 --- a/lib/Loop/UvDriver.php +++ b/lib/Loop/UvDriver.php @@ -255,8 +255,8 @@ class UvDriver extends Driver { unset($this->watchers[$eventId][$id]); if (empty($this->watchers[$eventId])) { - unset($this->watchers[$eventId]); - unset($this->io[(int) $watcher->value]); + unset($this->watchers[$eventId], $this->io[(int) $watcher->value]); + if (\uv_is_active($event)) { \uv_poll_stop($event); } diff --git a/lib/functions.php b/lib/functions.php index b90ca32..02954d2 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -74,8 +74,8 @@ namespace Amp { } namespace Amp\Promise { - use Amp\Loop; use Amp\Deferred; + use Amp\Loop; use Amp\MultiReasonException; use Amp\Promise; use Amp\Success; @@ -474,12 +474,12 @@ namespace Amp\Promise { namespace Amp\Stream { use Amp\Coroutine; use Amp\Emitter; - use Amp\StreamIterator; use Amp\Loop; use Amp\Pause; use Amp\Producer; use Amp\Promise; use Amp\Stream; + use Amp\StreamIterator; use Amp\UnionTypeError; /** diff --git a/test/AdaptTest.php b/test/AdaptTest.php index c4b78a1..13c9e56 100644 --- a/test/AdaptTest.php +++ b/test/AdaptTest.php @@ -3,8 +3,8 @@ namespace Amp\Test; use Amp\Failure; -use Amp\Success; use Amp\Promise; +use Amp\Success; class PromiseMock { /** @var \Amp\Promise */ diff --git a/test/AllTest.php b/test/AllTest.php index be8812c..6e1fcd7 100644 --- a/test/AllTest.php +++ b/test/AllTest.php @@ -2,10 +2,10 @@ namespace Amp\Test; +use Amp\Loop; use Amp\Pause; use Amp\Promise; use Amp\Success; -use Amp\Loop; class AllTest extends \PHPUnit\Framework\TestCase { public function testEmptyArray() { diff --git a/test/AnyTest.php b/test/AnyTest.php index 765b65e..de7f5bc 100644 --- a/test/AnyTest.php +++ b/test/AnyTest.php @@ -3,10 +3,10 @@ namespace Amp\Test; use Amp\Failure; +use Amp\Loop; use Amp\Pause; use Amp\Promise; use Amp\Success; -use Amp\Loop; class AnyTest extends \PHPUnit\Framework\TestCase { public function testEmptyArray() { diff --git a/test/CallTest.php b/test/CallTest.php index b5ae5cd..d7e09c5 100644 --- a/test/CallTest.php +++ b/test/CallTest.php @@ -4,8 +4,8 @@ namespace Amp\Test; use Amp; use Amp\Coroutine; -use Amp\Success; use Amp\Promise; +use Amp\Success; use PHPUnit\Framework\TestCase; use React\Promise\FulfilledPromise as FulfilledReactPromise; diff --git a/test/CaptureTest.php b/test/CaptureTest.php index a80809c..1641aa5 100644 --- a/test/CaptureTest.php +++ b/test/CaptureTest.php @@ -3,8 +3,8 @@ namespace Amp\Test; use Amp\Failure; -use Amp\Success; use Amp\Promise; +use Amp\Success; use function React\Promise\reject; class CaptureTest extends \PHPUnit\Framework\TestCase { diff --git a/test/CoroutineTest.php b/test/CoroutineTest.php index 5b754f7..ff1dd1c 100644 --- a/test/CoroutineTest.php +++ b/test/CoroutineTest.php @@ -7,8 +7,8 @@ use Amp\Failure; use Amp\InvalidYieldError; use Amp\Loop; use Amp\Pause; -use Amp\Success; use Amp\Promise; +use Amp\Success; use PHPUnit\Framework\TestCase; use React\Promise\FulfilledPromise as FulfilledReactPromise; use React\Promise\Promise as ReactPromise; diff --git a/test/FilterTest.php b/test/FilterTest.php index 257cebf..e5e3859 100644 --- a/test/FilterTest.php +++ b/test/FilterTest.php @@ -2,10 +2,10 @@ namespace Amp\Test; -use Amp\Producer; -use Amp\Stream; use Amp\Emitter; use Amp\Loop; +use Amp\Producer; +use Amp\Stream; class FilterTest extends \PHPUnit\Framework\TestCase { public function testNoValuesEmitted() { diff --git a/test/FirstTest.php b/test/FirstTest.php index 9d7e067..b6664a8 100644 --- a/test/FirstTest.php +++ b/test/FirstTest.php @@ -2,13 +2,12 @@ namespace Amp\Test; -use Amp; use Amp\Failure; +use Amp\Loop; use Amp\MultiReasonException; use Amp\Pause; use Amp\Promise; use Amp\Success; -use Amp\Loop; class FirstTest extends \PHPUnit\Framework\TestCase { /** diff --git a/test/LazyPromiseTest.php b/test/LazyPromiseTest.php index 00d1fe5..dd36d10 100644 --- a/test/LazyPromiseTest.php +++ b/test/LazyPromiseTest.php @@ -2,7 +2,6 @@ namespace Amp\Test; -use Amp; use Amp\Failure; use Amp\LazyPromise; use Amp\Success; diff --git a/test/Loop/DriverTest.php b/test/Loop/DriverTest.php index 24a9f88..8ab8800 100644 --- a/test/Loop/DriverTest.php +++ b/test/Loop/DriverTest.php @@ -8,7 +8,6 @@ use Amp\Loop; use Amp\Loop\Driver; use Amp\Loop\InvalidWatcherError; use Amp\Loop\UnsupportedFeatureException; -use Amp\Success; use PHPUnit\Framework\TestCase; use React\Promise\RejectedPromise as RejectedReactPromise; @@ -231,7 +230,6 @@ abstract class DriverTest extends TestCase { }); } - function provideRegistrationArgs() { $args = [ ["defer", [function () { diff --git a/test/MapTest.php b/test/MapTest.php index 90e2e3f..be71777 100644 --- a/test/MapTest.php +++ b/test/MapTest.php @@ -2,11 +2,10 @@ namespace Amp\Test; -use Amp; -use Amp\Producer; -use Amp\Stream; use Amp\Emitter; use Amp\Loop; +use Amp\Producer; +use Amp\Stream; class MapTest extends \PHPUnit\Framework\TestCase { public function testNoValuesEmitted() { diff --git a/test/PauseTest.php b/test/PauseTest.php index 042a94d..363954f 100644 --- a/test/PauseTest.php +++ b/test/PauseTest.php @@ -2,8 +2,8 @@ namespace Amp\Test; -use Amp\Pause; use Amp\Loop; +use Amp\Pause; class PauseTest extends \PHPUnit\Framework\TestCase { public function testPause() { diff --git a/test/PipeTest.php b/test/PipeTest.php index 4f83d05..88b6f9a 100644 --- a/test/PipeTest.php +++ b/test/PipeTest.php @@ -3,8 +3,8 @@ namespace Amp\Test; use Amp\Failure; -use Amp\Success; use Amp\Promise; +use Amp\Success; use function React\Promise\resolve; class PipeTest extends \PHPUnit\Framework\TestCase { diff --git a/test/ProducerTest.php b/test/ProducerTest.php index 228a437..20da971 100644 --- a/test/ProducerTest.php +++ b/test/ProducerTest.php @@ -4,9 +4,9 @@ namespace Amp\Test; use Amp; use Amp\Deferred; -use Amp\Producer; -use Amp\Pause; use Amp\Loop; +use Amp\Pause; +use Amp\Producer; use PHPUnit\Framework\TestCase; use React\Promise\Promise as ReactPromise; diff --git a/test/ProducerTraitTest.php b/test/ProducerTraitTest.php index 6166f4f..e9ac6dd 100644 --- a/test/ProducerTraitTest.php +++ b/test/ProducerTraitTest.php @@ -5,8 +5,8 @@ namespace Amp\Test; use Amp\Deferred; use Amp\Failure; use Amp\Loop; -use Amp\Success; use Amp\Promise; +use Amp\Success; use PHPUnit\Framework\TestCase; use React\Promise\FulfilledPromise as FulfilledReactPromise; diff --git a/test/SomeTest.php b/test/SomeTest.php index e822bac..612d06b 100644 --- a/test/SomeTest.php +++ b/test/SomeTest.php @@ -3,11 +3,11 @@ namespace Amp\Test; use Amp\Failure; +use Amp\Loop; use Amp\MultiReasonException; use Amp\Pause; use Amp\Promise; use Amp\Success; -use Amp\Loop; class SomeTest extends \PHPUnit\Framework\TestCase { public function testEmptyArray() { diff --git a/test/StreamFromIterableTest.php b/test/StreamFromIterableTest.php index b2ec20f..7d39dc2 100644 --- a/test/StreamFromIterableTest.php +++ b/test/StreamFromIterableTest.php @@ -3,11 +3,11 @@ namespace Amp\Test; use Amp\Failure; +use Amp\Loop; use Amp\Pause; use Amp\Promise; use Amp\Stream; use Amp\Success; -use Amp\Loop; class StreamFromIterableTest extends \PHPUnit\Framework\TestCase { const TIMEOUT = 10; diff --git a/test/StreamIteratorTest.php b/test/StreamIteratorTest.php index f096fdf..fbfe952 100644 --- a/test/StreamIteratorTest.php +++ b/test/StreamIteratorTest.php @@ -2,12 +2,11 @@ namespace Amp\Test; -use Amp; -use Amp\Producer; -use Amp\StreamIterator; -use Amp\Pause; use Amp\Emitter; use Amp\Loop; +use Amp\Pause; +use Amp\Producer; +use Amp\StreamIterator; use PHPUnit\Framework\TestCase; class StreamIteratorTest extends TestCase { diff --git a/test/SuccessTest.php b/test/SuccessTest.php index 3e65826..f8b46f8 100644 --- a/test/SuccessTest.php +++ b/test/SuccessTest.php @@ -3,8 +3,8 @@ namespace Amp\Test; use Amp\Loop; -use Amp\Success; use Amp\Promise; +use Amp\Success; use React\Promise\RejectedPromise as RejectedReactPromise; class SuccessTest extends \PHPUnit\Framework\TestCase { diff --git a/test/TimeoutTest.php b/test/TimeoutTest.php index 12c91de..153fe4a 100644 --- a/test/TimeoutTest.php +++ b/test/TimeoutTest.php @@ -5,8 +5,8 @@ namespace Amp\Test; use Amp\Failure; use Amp\Loop; use Amp\Pause; -use Amp\Success; use Amp\Promise; +use Amp\Success; use function React\Promise\resolve; class TimeoutTest extends \PHPUnit\Framework\TestCase { diff --git a/test/WaitTest.php b/test/WaitTest.php index 39915a2..62d9d48 100644 --- a/test/WaitTest.php +++ b/test/WaitTest.php @@ -4,10 +4,10 @@ namespace Amp\Test; use Amp\Deferred; use Amp\Failure; +use Amp\Loop; use Amp\Pause; use Amp\Promise; use Amp\Success; -use Amp\Loop; use PHPUnit\Framework\TestCase; use function React\Promise\resolve;