Skip to content

Commit 42d4410

Browse files
authored
Add PHPDoc callable types for BusFake methods (#58070)
Add proper callable type hints that document the callback signatures. This improves IDE autocompletion and static analysis support.
1 parent e4551e7 commit 42d4410

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Illuminate/Support/Testing/Fakes/BusFake.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ protected function assertDispatchedWithChainOfObjects($command, $expectedChain,
488488
/**
489489
* Create a new assertion about a chained batch.
490490
*
491-
* @param \Closure $callback
491+
* @param \Closure(\Illuminate\Bus\PendingBatch): bool $callback
492492
* @return \Illuminate\Support\Testing\Fakes\ChainedBatchTruthTest
493493
*/
494494
public function chainedBatch(Closure $callback)
@@ -499,7 +499,7 @@ public function chainedBatch(Closure $callback)
499499
/**
500500
* Assert if a batch was dispatched based on a truth-test callback.
501501
*
502-
* @param callable $callback
502+
* @param callable(\Illuminate\Bus\PendingBatch): bool $callback
503503
* @return void
504504
*/
505505
public function assertBatched(callable $callback)
@@ -606,8 +606,8 @@ public function dispatchedAfterResponse(string $command, $callback = null)
606606
/**
607607
* Get all of the pending batches matching a truth-test callback.
608608
*
609-
* @param callable $callback
610-
* @return \Illuminate\Support\Collection
609+
* @param callable(\Illuminate\Bus\PendingBatch): bool $callback
610+
* @return \Illuminate\Support\Collection<int, \Illuminate\Bus\PendingBatch>
611611
*/
612612
public function batched(callable $callback)
613613
{

src/Illuminate/Support/Testing/Fakes/ChainedBatchTruthTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ class ChainedBatchTruthTest
99
/**
1010
* The underlying truth test.
1111
*
12-
* @var \Closure
12+
* @var \Closure(\Illuminate\Bus\PendingBatch): bool
1313
*/
1414
protected $callback;
1515

1616
/**
1717
* Create a new truth test instance.
1818
*
19-
* @param \Closure $callback
19+
* @param \Closure(\Illuminate\Bus\PendingBatch): bool $callback
2020
*/
2121
public function __construct(Closure $callback)
2222
{

0 commit comments

Comments
 (0)