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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
*.webp binary
*.bmp binary
*.ttf binary
*.blp binary
*.db2 binary

# Ignoring files for distribution archieves
.github/ export-ignore
etc/ci/ export-ignore
etc/dev-app/ export-ignore
etc/qa/ export-ignore
examples/ export-ignore
tests/ export-ignore
Expand Down
12 changes: 8 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>WyriHaximus/renovate-config:php-package"
]
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>WyriHaximus/renovate-config:php-package"
],
"constraints": {
"php": "8.4.x",
"composer": "2.x"
}
}
115 changes: 85 additions & 30 deletions Makefile

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"react-parallel/stubs": "^1.2.0",
"react/promise-timer": "^1.11.0",
"wyrihaximus/async-test-utilities": "^12.2.0",
"wyrihaximus/makefiles": "^0.7.16"
"wyrihaximus/makefiles": "^0.10.6"
},
"autoload": {
"psr-4": {
Expand Down
18 changes: 9 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion etc/qa/infection.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"timeout": 66,
"source": {
"directories": [
"src"
"../../src"
]
},
"logs": {
Expand Down
1 change: 1 addition & 0 deletions etc/qa/phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<arg value="np" /> <!-- n = ignore warnings, p = show progress -->

<file>../../etc</file>
<file>../../examples</file>
<file>../../src</file>
<file>../../tests</file>

Expand Down
13 changes: 12 additions & 1 deletion etc/qa/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="../../vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd" cacheDirectory="../../var/phpunit/cache">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="../../vendor/autoload.php"
colors="true"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
cacheDirectory="../../var/phpunit/cache"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitDeprecations="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory>../../tests/</directory>
Expand Down
11 changes: 7 additions & 4 deletions examples/channel.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

use parallel\Channel;
use React\EventLoop\Loop;
use ReactParallel\EventLoop\EventLoopBridge;

use function React\Async\async;
use function React\Async\await;
use function React\Promise\Timer\sleep;
Expand All @@ -11,11 +14,11 @@

$eventLoopBridge = new EventLoopBridge();

Loop::futureTick(async(static function () use ($eventLoopBridge) {
/** @var Channel<string> */
Loop::futureTick(async(static function () use ($eventLoopBridge): void {
/** @var Channel<string> $channel */
$channel = new Channel(Channel::Infinite);

Loop::futureTick(async(function () use ($channel): void {
Loop::futureTick(async(static function () use ($channel): void {
$channel->send('Hello World!');
// Don't close the channel right after writing to it,
// as it will be closed on both ends and the other
Expand Down
9 changes: 6 additions & 3 deletions examples/future.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

use React\EventLoop\Loop;
use ReactParallel\EventLoop\EventLoopBridge;

use function parallel\run;
use function React\Async\async;

require_once __DIR__ . '/../vendor/autoload.php';

$eventLoopBridge = new EventLoopBridge();

Loop::futureTick(async(static function () use ($eventLoopBridge) {
$future = run(function (): string {
Loop::futureTick(async(static function () use ($eventLoopBridge): void {
$future = run(static function (): string {
return 'Hello World!';
});

Expand Down
2 changes: 0 additions & 2 deletions src/Done.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace ReactParallel\EventLoop;

/**
* @internal
*
* Marker class for when a stream is done
*/
final class Done
Expand Down
6 changes: 5 additions & 1 deletion src/EventLoopBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,12 @@ private function handleFutureReadEvent(Event $event): void
/** @param Event<mixed> $event */
private function handleChannelReadEvent(Event $event): void
{
if (! ($event->object instanceof Channel)) {
return;
}

$this->channels[spl_object_id($event->object)]->value($event->value);
$this->events->addChannel($event->object); /** @phpstan-ignore-line */
$this->events->addChannel($event->object);

if (! ($this->metrics instanceof Metrics)) {
return;
Expand Down
2 changes: 0 additions & 2 deletions src/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace ReactParallel\EventLoop;

/**
* @internal
*
* Marker class for when a stream is received a value
*/
final class Value
Expand Down
Loading