vuongxuongminh/laravel-async

Issue running AsyncFacade run function

andreinocenti opened this issue · 0 comments

Hi,

I'm using your package version 4.0.0 with Laravel 10. I followed the instructions for installation of the package and I have both PCNTL and POSIX extensions installed.

I runned the eg. code below

for ($i = 1; $i < 20; $i++) {
            AsyncFacade::run(function () use ($i) {
                sleep(1);

                return $i;
            });
        }

And I got this error:

Declaration of VXM\Async\Runtime\ParentRuntime::createProcess($task, ?int $outputLength = null, ?string $binary = 'php'): Spatie\Async\Process\Runnable must be compatible with Spatie\Async\Runtime\ParentRuntime::createProcess($task, ?int $outputLength = null, ?string $binary = 'php', ?int $max_input_size = 100000): Spatie\Async\Process\Runnable

  at vendor/vxm/laravel-async/src/Runtime/ParentRuntime.php:24
     20▕  * @since 1.0.0
     21▕  */
     22class ParentRuntime extends BaseParentRuntime
     23▕ {
  ➜  24public static function createProcess($task, ?int $outputLength = null, ?string $binary = 'php'): Runnable
     25▕     {
     26$runnable = parent::createProcess($task, $outputLength, $binary);
     2728if ($runnable instanceof SynchronousProcess) {