Failed Conditions
Push — master ( ac0e13...24dbc4 )
by Sergei
22s queued 15s
created

ConnectionError::new()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 1
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Driver\Mysqli\Exception;
6
7
use Doctrine\DBAL\Driver\Mysqli\MysqliException;
8
use mysqli;
9
10
final class ConnectionError extends MysqliException
11
{
12
    public static function new(mysqli $connection) : self
13
    {
14
        $connectionSQLState = $connection->sqlstate;
15
16
        $sqlState = null;
17
        if ($connectionSQLState !== false) {
0 ignored issues
show
introduced by
The condition $connectionSQLState !== false is always true.
Loading history...
18
            $sqlState = $connectionSQLState;
19
        }
20
21
        return new self($connection->error, $sqlState, $connection->errno);
22
    }
23
}
24