spatie / async

Easily run code asynchronously

Home Page:https://spatie.be/en/opensource/php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return type of Spatie\Async\Pool::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool

gopibabus opened this issue · comments

Piece of code that I am trying to execute

use Spatie\Async\Pool;

$pool = Pool::create();

foreach (range(1, 5) as $i) {
    $pool[] = async(function () {
        usleep(random_int(10, 1000));

        return 2;
    })->then(function (int $output) {
        $this->counter += $output;
    });
}

await($pool);

Installed Version of PHP
8.0.*

Error Screenshot:
image

I hope this helps you. Please let me know if you need any further details. Thanks for your contribution.

Same issue with PHP 8.1.7

#184 would fix this issue

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.