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 @@ -27,7 +27,7 @@
"react-parallel/pool-tests": "^5.1.0 || ^6.0.0",
"react-parallel/stubs": "^1.2",
"wyrihaximus/async-test-utilities": "^12.2.0",
"wyrihaximus/makefiles": "^0.7.16"
"wyrihaximus/makefiles": "^0.10.6"
},
"suggest": {
"ext-random": "More secure group names"
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": 1800,
"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
5 changes: 3 additions & 2 deletions examples/echo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
use React\EventLoop\Loop;
use ReactParallel\EventLoop\EventLoopBridge;
use ReactParallel\Pool\Infinite\Infinite;

use function React\Async\async;

require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

$infinite = new Infinite(new EventLoopBridge(), 1);

Loop::futureTick(async(static function () use ($infinite) {
echo $infinite->run(function () {
Loop::futureTick(async(static function () use ($infinite): void {
echo $infinite->run(static function () {
sleep(1);

return 'Hoi!';
Expand Down
2 changes: 1 addition & 1 deletion examples/exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$infinite = new Infinite(new EventLoopBridge(), 1);

Loop::futureTick(async(static function () use ($infinite) {
Loop::futureTick(async(static function () use ($infinite): void {
try {
$infinite->run(static function (): void {
throw new RuntimeException('Whoops I did it again!');
Expand Down
8 changes: 4 additions & 4 deletions examples/json.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

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

use ReactParallel\Pool\Infinite\Infinite;

use function React\Async\async;
use function React\Async\await;
use function React\Promise\all;
Expand All @@ -16,16 +16,16 @@

$infinite = new Infinite(new EventLoopBridge(), 1);

Loop::futureTick(async(static function () use ($infinite, $json) {
$promises = [];
Loop::futureTick(async(static function () use ($infinite, $json): void {
$promises = [];
$signalHandler = static function () use ($infinite): void {
Loop::stop();
$infinite->close();
};

$tick = async(static function () use (&$promises, $infinite, $signalHandler, $json, &$tick): void {
if (count($promises) < 1000) {
$promises[] = async(static fn(string $json): string => $infinite->run(static function ($json): string {
$promises[] = async(static fn (string $json): string => $infinite->run(static function ($json): string {
$json = json_decode($json, true);

return md5(json_encode($json));
Expand Down
2 changes: 1 addition & 1 deletion examples/sleep.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

$infinite = new Infinite(new EventLoopBridge(), 0.1);

Loop::futureTick(async(static function () use ($infinite) {
Loop::futureTick(async(static function () use ($infinite): void {
$timer = Loop::addPeriodicTimer(1, static function () use ($infinite): void {
var_export(iteratorOrArrayToArray($infinite->info()));
});
Expand Down
9 changes: 5 additions & 4 deletions examples/versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
use React\EventLoop\Loop;
use ReactParallel\EventLoop\EventLoopBridge;
use ReactParallel\Pool\Infinite\Infinite;

use function React\Async\async;

require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

$infinite = new Infinite(new EventLoopBridge(), 0.1);

Loop::futureTick(async(static function () use ($infinite) {
Loop::futureTick(async(static function () use ($infinite): void {
Loop::addTimer(1, static function () use ($infinite): void {
$infinite->kill();
Loop::stop();
Expand All @@ -26,8 +27,8 @@
$package => InstalledVersions::getPrettyVersion($package),
],
InstalledVersions::getInstalledPackages(),
)
)
)
),
),
),
);
}));
3 changes: 1 addition & 2 deletions tests/ExternalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ final class ExternalTest extends AbstractPoolTest
{
use PoolInfoTestTrait;

/** @phpstan-ignore-next-line */
private function poolFactory(): PoolInfoInterface
protected function poolFactory(): PoolInfoInterface
{
return new Infinite(new EventLoopBridge(), 5)->withMetrics(Metrics::create(MetricsFactory::create()));
}
Expand Down
9 changes: 5 additions & 4 deletions tests/InfiniteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public function withAZeroTTLThreadsShouldBeKilledOffImmidetally(): void
], [...$pool->info()]);

$pool->kill();
self::assertSame(42, $asteriks); /** @phpstan-ignore-line */
/** @phpstan-ignore staticMethod.alreadyNarrowedType */
self::assertSame(42, $asteriks);
}

#[Test]
Expand Down Expand Up @@ -142,11 +143,11 @@ public function withAnAlmostZeroTTLThreadsShouldNotBeKilledOffImmidetally(): voi
], [...$pool->info()]);

$pool->kill();
self::assertSame(42, $asteriks); /** @phpstan-ignore-line */
/** @phpstan-ignore staticMethod.alreadyNarrowedType */
self::assertSame(42, $asteriks);
}

/** @phpstan-ignore-next-line */
private function poolFactory(): PoolInfoInterface
protected function poolFactory(): PoolInfoInterface
{
return new Infinite(new EventLoopBridge(), 5)->withMetrics(Metrics::create(MetricsFactory::create()));
}
Expand Down
Loading