Skip to content

Commit 8d78a6f

Browse files
committed
Return a Closure from AsyncTestCase::createCallback()
1 parent 2e79fa8 commit 8d78a6f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/AsyncTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ final protected function setTimeout(float $timeout): void
185185
* @param int $invocationCount Number of times the callback must be invoked or the test will fail.
186186
* @param callable|null $returnCallback Callable providing a return value for the callback.
187187
*
188-
* @return callable|MockObject Mock object having only an __invoke method.
188+
* @return \Closure&MockObject Mock object having only an __invoke method.
189189
*/
190-
final protected function createCallback(int $invocationCount, callable $returnCallback = null): callable
190+
final protected function createCallback(int $invocationCount, callable $returnCallback = null): \Closure
191191
{
192192
$mock = $this->createMock(CallbackStub::class);
193193
$invocationMocker = $mock->expects(self::exactly($invocationCount))
@@ -197,6 +197,6 @@ final protected function createCallback(int $invocationCount, callable $returnCa
197197
$invocationMocker->willReturnCallback($returnCallback);
198198
}
199199

200-
return $mock;
200+
return \Closure::fromCallable($mock);
201201
}
202202
}

0 commit comments

Comments
 (0)