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
Loading history...
|
|||
18 | $sqlState = $connectionSQLState; |
||
19 | } |
||
20 | |||
21 | return new self($connection->error, $sqlState, $connection->errno); |
||
22 | } |
||
23 | } |
||
24 |