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

ConnectionError   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A new() 0 10 2
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