Skip to content

Commit ca37a22

Browse files
committed
Updated retry library from ^2 -> ^2.1 for promise-based exception handlers.
Deprecated specification context. Minor fixes.
1 parent a348f4a commit ca37a22

6 files changed

Lines changed: 16 additions & 10 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
"require": {
1212
"php": "^7.1",
1313
"scriptfusion/static-class": "^1",
14-
"scriptfusion/retry": "^2",
14+
"scriptfusion/retry": "^2.1",
1515
"scriptfusion/retry-exception-handlers": "^1.1",
1616
"amphp/amp": "^2",
1717
"psr/container": "^1",
1818
"psr/cache": "^1"
1919
},
2020
"require-dev": {
2121
"phpunit/phpunit": "^7.1.3",
22-
"bilge/mockery": "dev-issue-871"
22+
"mockery/mockery": "^1.1"
2323
},
2424
"suggest" : {
2525
"connectors/http": "Provides an HTTP connector for Porter providers.",

src/Collection/CountableRecordsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ public function count(): int
1515

1616
private function setCount(int $count): void
1717
{
18-
$this->count = $count | 0;
18+
$this->count = $count;
1919
}
2020
}

src/Connector/ImportConnector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* Connector whose lifecycle is synchronised with an import operation. Ensures correct ConnectionContext is delivered
14-
* to the wrapped connector.
14+
* to the wrapped connector and intercepts failed connections to facilitate automatic retries.
1515
*
1616
* Do not store references to this connector that would prevent it expiring when an import operation ends.
1717
*
@@ -111,12 +111,12 @@ private function createExceptionHandler(): \Closure
111111
* Invokes the specified fetch exception handler, cloning it if required.
112112
*
113113
* @param RecoverableExceptionHandler $handler Fetch exception handler.
114-
* @param \Exception $exception Exception to pass to the handler.
114+
* @param RecoverableException $recoverableException Recoverable exception to pass to the handler.
115115
* @param bool $cloned False if handler requires cloning, true if handler has already been cloned.
116116
*/
117117
private static function invokeHandler(
118118
RecoverableExceptionHandler &$handler,
119-
\Exception $exception,
119+
RecoverableException $recoverableException,
120120
bool &$cloned
121121
): void {
122122
if (!$cloned && !$handler instanceof StatelessRecoverableExceptionHandler) {
@@ -125,7 +125,7 @@ private static function invokeHandler(
125125
$cloned = true;
126126
}
127127

128-
$handler($exception);
128+
$handler($recoverableException);
129129
}
130130

131131
/**

src/Connector/Recoverable/ExponentialSleepRecoverableExceptionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class ExponentialSleepRecoverableExceptionHandler implements RecoverableExceptio
2020
*
2121
* @param int $initialDelay Initial delay.
2222
*/
23-
public function __construct($initialDelay = ExponentialBackoffExceptionHandler::DEFAULT_COEFFICIENT)
23+
public function __construct(int $initialDelay = ExponentialBackoffExceptionHandler::DEFAULT_COEFFICIENT)
2424
{
25-
$this->initialDelay = $initialDelay | 0;
25+
$this->initialDelay = $initialDelay;
2626
}
2727

2828
public function initialize(): void

src/Connector/Recoverable/RecoverableExceptionHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public function initialize(): void;
2727

2828
/**
2929
* Handles a recoverable exception.
30+
*
31+
* @return mixed
3032
*/
31-
public function __invoke(RecoverableException $exception): void;
33+
public function __invoke(RecoverableException $exception);
3234
}

src/Specification/ImportSpecification.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ private function hasTransformer(Transformer $transformer): bool
167167

168168
/**
169169
* @return mixed
170+
*
171+
* @deprecated TODO: Evaluate whether context can be removed.
170172
*/
171173
final public function getContext()
172174
{
@@ -177,6 +179,8 @@ final public function getContext()
177179
* @param mixed $context
178180
*
179181
* @return $this
182+
*
183+
* @deprecated TODO: Evaluate whether context can be removed.
180184
*/
181185
final public function setContext($context): self
182186
{

0 commit comments

Comments
 (0)