Skip to content

Commit 7b8a9e7

Browse files
committed
Merge branch 'main' of github.com:hypervel/components
2 parents dc8872b + d8045c8 commit 7b8a9e7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/redis/src/Redis.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ public function __call($name, $arguments)
2828
$hasContextConnection = Context::has($this->getContextKey());
2929
$connection = $this->getConnection($hasContextConnection);
3030

31+
$hasError = false;
3132
$start = (float) microtime(true);
3233

3334
try {
3435
/** @var RedisConnection $connection */
3536
$connection = $connection->getConnection();
3637
$result = $connection->{$name}(...$arguments);
3738
} catch (Throwable $exception) {
39+
$hasError = true;
3840
throw $exception;
3941
} finally {
4042
$time = round((microtime(true) - $start) * 1000, 2);
@@ -51,7 +53,7 @@ public function __call($name, $arguments)
5153
);
5254

5355
if ($hasContextConnection) {
54-
return;
56+
return $hasError ? null : $result; // @phpstan-ignore-line
5557
}
5658

5759
// Release connection.
@@ -65,7 +67,7 @@ public function __call($name, $arguments)
6567
$this->releaseContextConnection();
6668
});
6769

68-
return;
70+
return $hasError ? null : $result; // @phpstan-ignore-line
6971
}
7072

7173
// Release the connection after command executed.

0 commit comments

Comments
 (0)