File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public function add($jobs)
9898 protected function ensureJobIsBatchable (object |array $ job ): void
9999 {
100100 foreach (Arr::wrap ($ job ) as $ job ) {
101- if ($ job instanceof PendingBatch) {
101+ if ($ job instanceof PendingBatch || $ job instanceof Closure ) {
102102 return ;
103103 }
104104
Original file line number Diff line number Diff line change @@ -244,6 +244,17 @@ public function test_it_throws_an_exception_if_batched_job_contains_batch_with_n
244244 )
245245 );
246246 }
247+
248+ public function test_it_can_batch_a_closure (): void
249+ {
250+ new PendingBatch (
251+ new Container ,
252+ new Collection ([
253+ function () {}
254+ ])
255+ );
256+ $ this ->expectNotToPerformAssertions ();
257+ }
247258}
248259
249260class BatchableJob
You can’t perform that action at this time.
0 commit comments