Issues (201)

src/Driver/Mysqli/Exception/ConnectionError.php (1 issue)

Severity
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
/**
11
 * @psalm-immutable
12
 */
13
final class ConnectionError extends MysqliException
14
{
15 553
    public static function new(mysqli $connection) : self
16
    {
17 553
        $connectionSQLState = $connection->sqlstate;
18
19 553
        $sqlState = null;
20 553
        if ($connectionSQLState !== false) {
0 ignored issues
show
The condition $connectionSQLState !== false is always true.
Loading history...
21 524
            $sqlState = $connectionSQLState;
22
        }
23
24 553
        return new self($connection->error, $sqlState, $connection->errno);
25
    }
26
}
27