src/MxToolbox/NetworkTools/SmtpServerChecks.php
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public function __construct(NetworkTools $netTool, $addr, $myHostName, $mailFrom, $mailRcptTo)
Remove error control operator '@' on line 130. Open
Open
private function setSmtpConnect($addr)
{
$this->smtpConnection = @stream_socket_client($addr . ':' . $this->smtpPort, $errno, $errstr,
$this->connTimeout, STREAM_CLIENT_CONNECT);
if (is_resource($this->smtpConnection)) {
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Avoid unused local variables such as '$errno'. Open
Open
$this->smtpConnection = @stream_socket_client($addr . ':' . $this->smtpPort, $errno, $errstr,
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$errstr'. Open
Open
$this->smtpConnection = @stream_socket_client($addr . ':' . $this->smtpPort, $errno, $errstr,
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}