ConnectionFailed.php 402 Bytes
Newer Older
1 2 3 4 5 6
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Driver\Mysqli\Exception;

7
use Doctrine\DBAL\Driver\AbstractException;
8 9 10 11 12 13 14
use mysqli;

/**
 * @internal
 *
 * @psalm-immutable
 */
15
final class ConnectionFailed extends AbstractException
16 17 18 19 20 21
{
    public static function new(mysqli $connection): self
    {
        return new self($connection->connect_error, 'HY000', $connection->connect_errno);
    }
}