It seems like you do not handle an error condition for connect(). This can introduce security issues, and is generally not recommended.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled annotation
If you suppress an error, we recommend checking for the error condition explicitly:
// For example instead of@mkdir($dir);// Better useif(@mkdir($dir)===false){thrownew\RuntimeException('The directory '.$dir.' could not be created.');}
Loading history...
81
2
} catch (\RedisException $e) {
82
2
$this->error = true;
83
2
$this->errorMessage = $e->getMessage();
84
2
$this->errorCode = 1;
85
}
86
}
87
3
return $this->instance;
88
}
89
90
/**
91
* return true if error
92
*
93
* @return boolean
94
*/
95
3
public function isError(): bool
96
{
97
3
return $this->error === true;
98
}
99
100
/**
101
* return code error
102
*
103
* @return int
104
*/
105
3
public function getErrorCode(): int
106
{
107
3
return $this->errorCode;
108
}
109
110
/**
111
* return error message
112
*
113
* @return string
114
*/
115
3
public function getErrorMessage(): string
116
{
117
3
return $this->errorMessage;
118
}
119
120
/**
121
* set redis server config
122
*
123
* @param string $host
124
* @param integer $port
125
* @return Adapter
126
*/
127
1
protected function applyConfig(string $host, int $port): Adapter
If you suppress an error, we recommend checking for the error condition explicitly: