Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"wyrihaximus/metrics": "^2.1"
},
"require-dev": {
"react-parallel/stubs": "^1.1",
"wyrihaximus/async-test-utilities": "^5.0.25 || ^8.0.5"
},
"autoload": {
Expand Down
4,196 changes: 2,700 additions & 1,496 deletions composer.lock

Large diffs are not rendered by default.

39 changes: 25 additions & 14 deletions etc/qa/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
parameters:
level: max
ignoreErrors:
-
message: '#Control structures using switch should not be used.#'
path: ../../src/EventLoopBridge.php
-
message: '#Language construct isset\(\) should not be used.#'
path: ../../src/EventLoopBridge.php
-
message: '#Property ReactParallel\\EventLoop\\Stream<T>::\$wait \(React\\Promise\\Deferred<ReactParallel\\EventLoop\\Done\|ReactParallel\\EventLoop\\Value>\) does not accept React\\Promise\\Deferred<mixed>.#'
path: ../../src/Stream.php
-
message: '#Result of method ReactParallel\\EventLoop\\EventLoopBridge::await\(\) \(void\) is used.#'
path: ../../tests/Types.php
# ergebnis:
# noExtends:
# classesAllowedToBeExtended:
# - ReactParallel\EventLoop\CancelledException
# - ReactParallel\EventLoop\CanceledFuture
# - ReactParallel\EventLoop\KilledRuntime
stubFiles:
- ../../stubs/Event.stub
# - ../../stubs/Events.stub
- ../../stubs/Future.stub
- ../../stubs/Channel.stub
- ../../stubs/functions.stub
-
message: '#usleep blocks the event loop, use React\\Promise\\Timer\\sleep#'
path: ../../tests/EventLoopBridgeTest.php
-
message: '#sleep blocks the event loop, use React\\Promise\\Timer\\sleep#'
path: ../../tests/EventLoopBridgeTest.php
ergebnis:
noExtends:
classesAllowedToBeExtended:
- Exception
- ReactParallel\EventLoop\CancelledException
- ReactParallel\EventLoop\CanceledFuture
- ReactParallel\EventLoop\KilledRuntime

#includes:
# - ../../vendor/wyrihaximus/async-test-utilities/rules.neon
includes:
- ../../vendor/wyrihaximus/async-test-utilities/rules.neon
- ../../vendor/react-parallel/stubs/extension.neon
9 changes: 5 additions & 4 deletions etc/qa/psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
</ignoreFiles>
</projectFiles>
<stubs>
<file name="../../stubs/Channel.stub" />
<file name="../../stubs/Event.stub" />
<file name="../../stubs/functions.stub" />
<file name="../../stubs/Future.stub" />
<file name="../../vendor/react-parallel/stubs/stubs/Channel.stub" />
<file name="../../vendor/react-parallel/stubs/stubs/Event.stub" />
<file name="../../vendor/react-parallel/stubs/stubs/functions.stub" />
<file name="../../vendor/react-parallel/stubs/stubs/Future.stub" />
<file name="../../vendor/react-parallel/stubs/stubs/Runtime.stub" />
</stubs>
<issueHandlers>

Expand Down
2 changes: 2 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
"@default": true,
"InstanceOf_": {
"ignore": [
"ReactParallel\\EventLoop\\EventLoopBridge::handleFutureReadEvent",
"ReactParallel\\EventLoop\\EventLoopBridge::handleCancelEvent"
]
},
"LogicalNot": {
"ignore": [
"ReactParallel\\EventLoop\\EventLoopBridge::handleFutureReadEvent",
"ReactParallel\\EventLoop\\EventLoopBridge::handleCancelEvent"
]
},
Expand Down
82 changes: 0 additions & 82 deletions stubs/Channel.stub

This file was deleted.

36 changes: 0 additions & 36 deletions stubs/Event.stub

This file was deleted.

54 changes: 0 additions & 54 deletions stubs/Future.stub

This file was deleted.

13 changes: 0 additions & 13 deletions stubs/functions.stub

This file was deleted.

12 changes: 2 additions & 10 deletions tests/EventLoopBridgeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace ReactParallel\Tests\EventLoop;

use parallel\Channel;
use parallel\Future;
use parallel\Runtime;
use React\EventLoop\Loop;
use ReactParallel\EventLoop\CanceledFuture;
Expand All @@ -16,7 +15,6 @@
use WyriHaximus\Metrics\Configuration;
use WyriHaximus\Metrics\InMemory\Registry;

use function assert;
use function bin2hex;
use function dirname;
use function parallel\run;
Expand All @@ -27,7 +25,6 @@
use function React\Promise\all;
use function React\Promise\resolve;
use function sleep;
use function time;
use function usleep;

final class EventLoopBridgeTest extends AsyncTestCase
Expand Down Expand Up @@ -60,7 +57,6 @@ public function read(): void

return 'Elmo';
});
assert($future instanceof Future);

$promises = [];
foreach ($channels as $channel) {
Expand Down Expand Up @@ -113,7 +109,6 @@ public function cancel(): void
self::expectException(CanceledFuture::class);

$future = run(static fn () => sleep(3));
assert($future instanceof Future);

$eventLoopBridge = (new EventLoopBridge())->withMetrics(Metrics::create(new Registry(Configuration::create())));

Expand All @@ -129,14 +124,12 @@ public function kill(): void
self::expectException(KilledRuntime::class);

$runtime = new Runtime();
$future = $runtime->run(static function (): int {
$future = $runtime->run(static function (): string {
sleep(3);

return time();
return 'hammer';
});

assert($future instanceof Future);

$eventLoopBridge = (new EventLoopBridge())->withMetrics(Metrics::create(new Registry(Configuration::create())));

Loop::addTimer(1, static function () use ($runtime): void {
Expand All @@ -158,7 +151,6 @@ public function futureError(): void

throw new CookieMonsterException('Cookie Monster');
});
assert($future instanceof Future);

$eventLoopBridge = (new EventLoopBridge())->withMetrics(Metrics::create(new Registry(Configuration::create())));

Expand Down
4 changes: 2 additions & 2 deletions tests/Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
return true;
})));

assertType('bool|int', $bridge->await(run(static function (): bool|int {
return time() % 2 !== 0 ? true : time();
assertType('bool|string', $bridge->await(run(static function (): bool|string {
return time() % 2 !== 0 ? true : 'hammer';
})));

assertType('null', $bridge->await(run(static function (): void {
Expand Down
Loading