laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.51k stars 11.02k forks source link

Method 'then' not found in \Illuminate\Foundation\Bus\PendingChain #48948

Closed kolibabchuk closed 1 year ago

kolibabchuk commented 1 year ago

Laravel Version

v10.31.0

PHP Version

8.2.10

Database Driver & Version

No response

Description

Method 'then' not found in \Illuminate\Foundation\Bus\PendingChain as it's described in documentation: https://laravel.com/docs/10.x/queues#chains-and-batches

Steps To Reproduce

use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Log;

Bus::chain([
  new FooJob($bar),
])->then(
  fn() => Log::info("No luck.")
)->dispatch();

Will throw an Error: "Call to undefined method Illuminate\Foundation\Bus\PendingChain::then()"

kolibabchuk commented 1 year ago

it looks like PendingChain.php didn't get update at all: https://github.com/laravel/framework/blob/v10.31.0/src/Illuminate/Foundation/Bus/PendingChain.php

driesvints commented 1 year ago

PendingChain is a new class. The then method here is incorrect I believe and should be removed from the docs.

cc @khepin

driesvints commented 1 year ago

https://github.com/laravel/docs/pull/9126

commando1251 commented 1 year ago

Same for me

driesvints commented 1 year ago

@commando1251 please see my messages above.