Skip to content

Commit dd58655

Browse files
committed
rename retry method to call
1 parent 00a71cd commit dd58655

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $callableThatMightFail = function (int $arg1, int $arg2): int {
2626

2727
// Allows you to call the callable with parameters and retry its execution in case an exception is thrown.
2828
// You can access the return value of the callable (3 in this case).
29-
$returnValue = Retry::retry($callableThatMightFail, 1, 2);
29+
$returnValue = Retry::call($callableThatMightFail, 1, 2);
3030

3131
// By default:
3232
// - The callable is retried twice (i.e. max three executions). If it still fails, the last error is rethrown.

src/Retry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public static function decorate(callable $callable): RetryingCallable
3232
*
3333
* @return mixed The return value of the passed callable
3434
*/
35-
public static function retry(callable $callable, ...$arguments)
35+
public static function call(callable $callable, ...$arguments)
3636
{
37-
return (new RetryConfigurator())->retry($callable, ...$arguments);
37+
return (new RetryConfigurator())->call($callable, ...$arguments);
3838
}
3939

4040
/**

src/RetryConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function decorate(callable $operation): RetryingCallable
141141
*
142142
* @return mixed The return value of the passed callable
143143
*/
144-
public function retry(callable $operation, ...$arguments)
144+
public function call(callable $operation, ...$arguments)
145145
{
146146
$retryingCallable = $this->decorate($operation);
147147

tests/RetryFunctionalityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testRetryDelays(): void
8282
{
8383
$start = microtime(true);
8484

85-
$returnValue = (new RetryConfigurator(2, 500))->retry($this->getCallable(2));
85+
$returnValue = (new RetryConfigurator(2, 500))->call($this->getCallable(2));
8686

8787
$elapsedTimeInMs = (microtime(true) - $start) * 1000;
8888

tests/RetryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public function testDecorate(): void
1919
$this->assertInstanceOf(RetryingCallable::class, Retry::decorate(function () { return 42; }));
2020
}
2121

22-
public function testRetryPassesOnArgumentsAndReturnsCallableReturnValue(): void
22+
public function testCallPassesOnArgumentsAndReturnsCallableReturnValue(): void
2323
{
24-
$this->assertSame(42, Retry::retry(function (int $arg1, int $arg2) { return $arg1 + $arg2; }, 40, 2));
24+
$this->assertSame(42, Retry::call(function (int $arg1, int $arg2) { return $arg1 + $arg2; }, 40, 2));
2525
}
2626
}

0 commit comments

Comments
 (0)