File tree Expand file tree Collapse file tree 1 file changed +10
-19
lines changed 
src/Instrumentation/Laravel/src/Watchers/RedisCommand Expand file tree Collapse file tree 1 file changed +10
-19
lines changed Original file line number Diff line number Diff line change @@ -89,28 +89,19 @@ private function fetchDbIndex(Connection $connection): ?int
8989        }
9090    }
9191
92-     private  function  fetchDbHost (Connection $ connectionstring 
92+     private  function  fetchDbHost (Connection $ connection? string 
9393    {
94-         if  ($ connectioninstanceof  PhpRedisConnection) {
95-             $ host$ connectionclient ()->getHost ();
96- 
97-             if  ($ hostfalse ) {
98-                 throw  new  RuntimeException ('Cannot fetch database host. ' );
99-             }
100- 
101-             return  $ host
102-         } elseif  ($ connectioninstanceof  PredisConnection) {
103-             /** @psalm-suppress PossiblyUndefinedMethod */ 
104-             $ host$ connectionclient ()->getConnection ()->getParameters ()->host ;
105- 
106-             if  (is_int ($ host
107-                 throw  new  RuntimeException ('Cannot fetch database index. ' );
94+         try  {
95+             if  ($ connectioninstanceof  PhpRedisConnection) {
96+                 return  $ connectionclient ()->getHost ();
97+             } elseif  ($ connectioninstanceof  PredisConnection) {
98+                 /** @psalm-suppress PossiblyUndefinedMethod */ 
99+                 return  $ connectionclient ()->getConnection ()->getParameters ()->host ;
108100            }
109101
110-             return  $ host
102+             return  null ;
103+         } catch  (Throwable $ e
104+             return  null ;
111105        }
112- 
113-         throw  new  RangeException ('Unknown Redis connection instance:  '  . get_class ($ connection
114-         
115106    }
116107}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments