@@ -43,9 +43,9 @@ public function __construct(string $dsn, ?string $username = null, ?string $pass
4343 {
4444 parent ::__construct ($ dsn , $ username , $ password , $ options );
4545
46- if (( $ driver = $ this ->getAttribute (PDO ::ATTR_DRIVER_NAME )) !== ' mysql ' )
46+ if (' mysql ' !== $ driver = $ this ->getAttribute (PDO ::ATTR_DRIVER_NAME ))
4747 {
48- throw new PDOException (" Pdo\Mysql::__construct() cannot be used for connecting to the \" $ driver \ " driver " );
48+ throw new PDOException (\sprintf ( ' Pdo\Mysql::__construct() cannot be used for connecting to the "%s " driver ' , $ driver ) );
4949 }
5050 }
5151
@@ -54,8 +54,8 @@ public static function connect(string $dsn, ?string $username = null, ?string $p
5454 try {
5555 return new self ($ dsn , $ username , $ password , $ options );
5656 } catch (PDOException $ e ) {
57- throw preg_match ('/Pdo \\\\Mysql::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/ ' , $ e ->getMessage (), $ matches )
58- ? new PDOException (" Pdo\Mysql::connect() cannot be used for connecting to the \"{ $ matches [1 ]}\" driver " )
57+ throw preg_match ('/^ Pdo \\\\Mysql::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/ ' , $ e ->getMessage (), $ matches )
58+ ? new PDOException (\sprintf ( ' Pdo\Mysql::connect() cannot be used for connecting to the "%s" driver ' , $ matches [1 ]) )
5959 : $ e ;
6060 }
6161 }
@@ -87,9 +87,9 @@ public function __construct(string $dsn, ?string $username = null, ?string $pass
8787 {
8888 parent ::__construct ($ dsn , $ username , $ password , $ options );
8989
90- if (( $ driver = $ this ->getAttribute (PDO ::ATTR_DRIVER_NAME )) !== ' mysql ' )
90+ if (' mysql ' !== $ driver = $ this ->getAttribute (PDO ::ATTR_DRIVER_NAME ))
9191 {
92- throw new PDOException (" Pdo\Mysql::__construct() cannot be used for connecting to the \" $ driver \ " driver " );
92+ throw new PDOException (\sprintf ( ' Pdo\Mysql::__construct() cannot be used for connecting to the "%s " driver ' , $ driver ) );
9393 }
9494 }
9595
@@ -98,8 +98,8 @@ public static function connect(string $dsn, ?string $username = null, ?string $p
9898 try {
9999 return new self ($ dsn , $ username , $ password , $ options );
100100 } catch (PDOException $ e ) {
101- throw preg_match ('/Pdo \\\\Mysql::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/ ' , $ e ->getMessage (), $ matches )
102- ? new PDOException (" Pdo\Mysql::connect() cannot be used for connecting to the \"{ $ matches [1 ]}\" driver " )
101+ throw preg_match ('/^ Pdo \\\\Mysql::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/ ' , $ e ->getMessage (), $ matches )
102+ ? new PDOException (\sprintf ( ' Pdo\Mysql::connect() cannot be used for connecting to the "%s" driver ' , $ matches [1 ]) )
103103 : $ e ;
104104 }
105105 }
0 commit comments