From aa15c305247504e936a4c8195a3cef0b148779d3 Mon Sep 17 00:00:00 2001 From: Valentin Claras Date: Fri, 12 Mar 2021 22:58:45 +0100 Subject: [PATCH 1/4] fix: update amp test because of a library change --- tests/Adapter/Amp/EventLoopTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Adapter/Amp/EventLoopTest.php b/tests/Adapter/Amp/EventLoopTest.php index 8ab2817..cbce018 100644 --- a/tests/Adapter/Amp/EventLoopTest.php +++ b/tests/Adapter/Amp/EventLoopTest.php @@ -17,4 +17,20 @@ public function testStreamShouldReadFromWritable($expectedSequence = '') // Because Amp resolve promises in a slightly different order. parent::testStreamShouldReadFromWritable('W0R0W12345R12R34W6R56R'); } + + public function testStreamShouldNotBeWritableIfClosed() + { + assert_options(ASSERT_EXCEPTION, 1); + $this->expectException(\Throwable::class); + + parent::testStreamShouldNotBeWritableIfClosed(); + } + + public function testStreamShouldNotBeReadableIfClosed() + { + assert_options(ASSERT_EXCEPTION, 1); + $this->expectException(\Throwable::class); + + parent::testStreamShouldNotBeReadableIfClosed(); + } } From 3e92fb8bda58d5574317b3a85624ca56c5a7f7fe Mon Sep 17 00:00:00 2001 From: Valentin Claras Date: Sat, 13 Mar 2021 21:32:00 +0100 Subject: [PATCH 2/4] fix: update tech blog's url --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 55859c0..63b0d98 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ { "name": "M6Web", "email": "opensource@m6web.fr", - "homepage": "http://tech.m6web.fr/" + "homepage": "https://tech.bedrockstreaming.com" } ], "autoload": { From 5069d4252f99ae85a6a098d33761b464d9a1ad33 Mon Sep 17 00:00:00 2001 From: Valentin Claras Date: Wed, 17 Mar 2021 22:17:21 +0100 Subject: [PATCH 3/4] fix: add correct namespace to examples --- composer.json | 3 ++- examples/00-README-samples.php | 2 ++ examples/01-async-countdown.php | 2 ++ examples/02-failures.php | 2 ++ examples/03-http-client.php | 2 ++ examples/04-foreach.php | 2 ++ examples/{tests => Tests}/ExamplesTest.php | 2 +- 7 files changed, 13 insertions(+), 2 deletions(-) rename examples/{tests => Tests}/ExamplesTest.php (98%) diff --git a/composer.json b/composer.json index 63b0d98..df0dc6a 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ }, "autoload-dev": { "psr-4": { - "M6WebTest\\Tornado\\": "tests/" + "M6WebTest\\Tornado\\": "tests/", + "M6WebExamples\\Tornado\\": "examples/" } }, "require": { diff --git a/examples/00-README-samples.php b/examples/00-README-samples.php index 78e98e7..2b96a63 100755 --- a/examples/00-README-samples.php +++ b/examples/00-README-samples.php @@ -1,6 +1,8 @@ #!/usr/bin/env php Date: Wed, 17 Mar 2021 22:17:41 +0100 Subject: [PATCH 4/4] fix: update code style --- src/Adapter/Amp/Internal/Deferred.php | 8 ++------ src/Adapter/Amp/Internal/PromiseWrapper.php | 4 +--- src/Adapter/Guzzle/CurlMultiClientWrapper.php | 8 ++------ src/Adapter/Guzzle/HttpClient.php | 8 ++------ src/Adapter/ReactPhp/EventLoop.php | 2 +- src/Adapter/ReactPhp/Internal/Deferred.php | 8 ++------ src/Adapter/ReactPhp/Internal/PromiseWrapper.php | 4 +--- src/Adapter/Tornado/Internal/StreamEventLoop.php | 12 +++--------- src/Adapter/Tornado/SynchronousEventLoop.php | 4 +--- tests/Adapter/Guzzle/GuzzleMockWrapper.php | 12 +++--------- 10 files changed, 18 insertions(+), 52 deletions(-) diff --git a/src/Adapter/Amp/Internal/Deferred.php b/src/Adapter/Amp/Internal/Deferred.php index 524d2cf..6b412bd 100644 --- a/src/Adapter/Amp/Internal/Deferred.php +++ b/src/Adapter/Amp/Internal/Deferred.php @@ -10,14 +10,10 @@ */ class Deferred implements \M6Web\Tornado\Deferred { - /** - * @var \Amp\Deferred - */ + /** @var \Amp\Deferred */ private $ampDeferred; - /** - * @var PromiseWrapper - */ + /** @var PromiseWrapper */ private $promise; public function __construct(\Amp\Deferred $ampDeferred, PromiseWrapper $promise) diff --git a/src/Adapter/Amp/Internal/PromiseWrapper.php b/src/Adapter/Amp/Internal/PromiseWrapper.php index abded1e..788c709 100644 --- a/src/Adapter/Amp/Internal/PromiseWrapper.php +++ b/src/Adapter/Amp/Internal/PromiseWrapper.php @@ -11,9 +11,7 @@ */ class PromiseWrapper implements Promise { - /** - * @var \Amp\Promise - */ + /** @var \Amp\Promise */ private $ampPromise; /** @var bool */ diff --git a/src/Adapter/Guzzle/CurlMultiClientWrapper.php b/src/Adapter/Guzzle/CurlMultiClientWrapper.php index bf78f07..6c72bf8 100644 --- a/src/Adapter/Guzzle/CurlMultiClientWrapper.php +++ b/src/Adapter/Guzzle/CurlMultiClientWrapper.php @@ -4,14 +4,10 @@ final class CurlMultiClientWrapper implements GuzzleClientWrapper { - /** - * @var \GuzzleHttp\Handler\CurlMultiHandler - */ + /** @var \GuzzleHttp\Handler\CurlMultiHandler */ private $curlMultiHandler; - /** - * @var \GuzzleHttp\Client - */ + /** @var \GuzzleHttp\Client */ private $guzzleClient; /** diff --git a/src/Adapter/Guzzle/HttpClient.php b/src/Adapter/Guzzle/HttpClient.php index 5ed0caf..da38f83 100644 --- a/src/Adapter/Guzzle/HttpClient.php +++ b/src/Adapter/Guzzle/HttpClient.php @@ -10,14 +10,10 @@ class HttpClient implements \M6Web\Tornado\HttpClient { - /** - * @var EventLoop - */ + /** @var EventLoop */ private $eventLoop; - /** - * @var GuzzleClientWrapper - */ + /** @var GuzzleClientWrapper */ private $clientWrapper; private $nbConcurrentRequests = 0; diff --git a/src/Adapter/ReactPhp/EventLoop.php b/src/Adapter/ReactPhp/EventLoop.php index fcc9bab..db4e189 100644 --- a/src/Adapter/ReactPhp/EventLoop.php +++ b/src/Adapter/ReactPhp/EventLoop.php @@ -196,7 +196,7 @@ public function delay(int $milliseconds): Promise { $deferred = $this->deferred(); $this->reactEventLoop->addTimer( - $milliseconds / 1000 /* milliseconds per second */, + $milliseconds / 1000 /* milliseconds per second */ , function () use ($deferred) { $deferred->resolve(null); } diff --git a/src/Adapter/ReactPhp/Internal/Deferred.php b/src/Adapter/ReactPhp/Internal/Deferred.php index cdd0c69..73a79c4 100644 --- a/src/Adapter/ReactPhp/Internal/Deferred.php +++ b/src/Adapter/ReactPhp/Internal/Deferred.php @@ -10,14 +10,10 @@ */ class Deferred implements \M6Web\Tornado\Deferred { - /** - * @var \React\Promise\Deferred - */ + /** @var \React\Promise\Deferred */ private $reactDeferred; - /** - * @var PromiseWrapper - */ + /** @var PromiseWrapper */ private $promise; public function __construct(\React\Promise\Deferred $reactDeferred, PromiseWrapper $promiseWrapper) diff --git a/src/Adapter/ReactPhp/Internal/PromiseWrapper.php b/src/Adapter/ReactPhp/Internal/PromiseWrapper.php index 8bab6df..170819a 100644 --- a/src/Adapter/ReactPhp/Internal/PromiseWrapper.php +++ b/src/Adapter/ReactPhp/Internal/PromiseWrapper.php @@ -11,9 +11,7 @@ */ class PromiseWrapper implements Promise { - /** - * @var \React\Promise\PromiseInterface - */ + /** @var \React\Promise\PromiseInterface */ private $reactPromise; /** @var bool */ diff --git a/src/Adapter/Tornado/Internal/StreamEventLoop.php b/src/Adapter/Tornado/Internal/StreamEventLoop.php index fee6e01..edf848b 100644 --- a/src/Adapter/Tornado/Internal/StreamEventLoop.php +++ b/src/Adapter/Tornado/Internal/StreamEventLoop.php @@ -9,17 +9,11 @@ */ class StreamEventLoop { - /** - * @var resource[] - */ + /** @var resource[] */ private $readStreams = []; - /** - * @var resource[] - */ + /** @var resource[] */ private $writeStreams = []; - /** - * @var PendingPromise[] - */ + /** @var PendingPromise[] */ private $pendingPromises = []; public function readable(EventLoop $eventLoop, $stream): PendingPromise diff --git a/src/Adapter/Tornado/SynchronousEventLoop.php b/src/Adapter/Tornado/SynchronousEventLoop.php index f33afae..21cd4f8 100644 --- a/src/Adapter/Tornado/SynchronousEventLoop.php +++ b/src/Adapter/Tornado/SynchronousEventLoop.php @@ -7,9 +7,7 @@ class SynchronousEventLoop implements \M6Web\Tornado\EventLoop { - /** - * @var \Throwable[] - */ + /** @var \Throwable[] */ private $asyncThrowables = []; /** diff --git a/tests/Adapter/Guzzle/GuzzleMockWrapper.php b/tests/Adapter/Guzzle/GuzzleMockWrapper.php index b5e6acf..e66023b 100644 --- a/tests/Adapter/Guzzle/GuzzleMockWrapper.php +++ b/tests/Adapter/Guzzle/GuzzleMockWrapper.php @@ -7,19 +7,13 @@ final class GuzzleMockWrapper implements GuzzleClientWrapper { - /** - * @var \GuzzleHttp\Client - */ + /** @var \GuzzleHttp\Client */ private $guzzleClient; - /** - * @var array - */ + /** @var array */ private $transactions = []; - /** - * @var int - */ + /** @var int */ public $ticks; public function __construct(array $queue)