vendor/doctrine/dbal/src/Driver/PDO/Exception.php line 30

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\DBAL\Driver\PDO;
  4. use Doctrine\DBAL\Driver\AbstractException;
  5. use PDOException;
  6. /**
  7.  * @internal
  8.  *
  9.  * @psalm-immutable
  10.  */
  11. final class Exception extends AbstractException
  12. {
  13.     public static function new(PDOException $exception): self
  14.     {
  15.         if ($exception->errorInfo !== null) {
  16.             [$sqlState$code] = $exception->errorInfo;
  17.             if ($code === null) {
  18.                 $code 0;
  19.             }
  20.         } else {
  21.             $code     $exception->getCode();
  22.             $sqlState null;
  23.         }
  24.         return new self($exception->getMessage(), $sqlState$code$exception);
  25.     }
  26. }