Skip to content

Commit ac5cb05

Browse files
daison12006013Daison Carino
andauthored
Cleanup: used illuminate str contains (#54647)
Co-authored-by: Daison Carino <daison@incube8.sg>
1 parent 2155a63 commit ac5cb05

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Illuminate/Redis/Connections/PhpRedisConnection.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Closure;
66
use Illuminate\Contracts\Redis\Connection as ConnectionContract;
77
use Illuminate\Support\Collection;
8+
use Illuminate\Support\Str;
89
use RedisException;
910

1011
/**
@@ -530,12 +531,8 @@ public function command($method, array $parameters = [])
530531
try {
531532
return parent::command($method, $parameters);
532533
} catch (RedisException $e) {
533-
foreach (['went away', 'socket', 'read error on connection', 'Connection lost'] as $errorMessage) {
534-
if (str_contains($e->getMessage(), $errorMessage)) {
535-
$this->client = $this->connector ? call_user_func($this->connector) : $this->client;
536-
537-
break;
538-
}
534+
if (Str::contains($e->getMessage(), ['went away', 'socket', 'read error on connection', 'Connection lost'])) {
535+
$this->client = $this->connector ? call_user_func($this->connector) : $this->client;
539536
}
540537

541538
throw $e;

0 commit comments

Comments
 (0)