File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 11<?php
22
3+ declare (strict_types=1 );
4+ /**
5+ * This file is part of Hyperf.
6+ *
7+ * @link https://www.hyperf.io
8+ * @document https://doc.hyperf.io
9+ 10+ * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11+ */
312
413namespace Hyperf \Redis \Exception ;
514
15+ use RuntimeException ;
616
7- class InvalidRedisConnectionException
17+ class InvalidRedisConnectionException extends RuntimeException
818{
9-
10- }
19+ }
Original file line number Diff line number Diff line change 1212
1313namespace Hyperf \Redis ;
1414
15+ use Hyperf \Redis \Exception \InvalidRedisConnectionException ;
1516use Hyperf \Redis \Pool \PoolFactory ;
1617use Hyperf \Utils \Context ;
1718
@@ -89,7 +90,10 @@ private function getConnection($hasContextConnection): RedisConnection
8990 }
9091 if (! $ connection instanceof RedisConnection) {
9192 $ pool = $ this ->factory ->getPool ($ this ->poolName );
92- return $ pool ->get ();
93+ $ connection = $ pool ->get ();
94+ }
95+ if (! $ connection instanceof RedisConnection) {
96+ throw new InvalidRedisConnectionException ('The connection is not a valid RedisConnection. ' );
9397 }
9498 return $ connection ;
9599 }
You can’t perform that action at this time.
0 commit comments