Skip to content

Commit 62b8a86

Browse files
CS fixes
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
1 parent 8607c5a commit 62b8a86

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

src/Php84/Resources/stubs/Pdo/Dblib.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public function __construct(string $dsn, ?string $username = null, ?string $pass
2828
{
2929
parent::__construct($dsn, $username, $password, $options);
3030

31-
if (($driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME)) !== 'dblib')
31+
if ('dblib' !== $driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME))
3232
{
33-
throw new PDOException("Pdo\Dblib::__construct() cannot be used for connecting to the \"$driver\" driver");
33+
throw new PDOException(\sprintf('Pdo\Dblib::__construct() cannot be used for connecting to the "%s" driver', $driver));
3434
}
3535
}
3636

@@ -39,8 +39,8 @@ public static function connect(string $dsn, ?string $username = null, ?string $p
3939
try {
4040
return new self($dsn, $username, $password, $options);
4141
} catch (PDOException $e) {
42-
throw preg_match('/Pdo\\\\Dblib::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
43-
? new PDOException("Pdo\Dblib::connect() cannot be used for connecting to the \"{$matches[1]}\" driver")
42+
throw preg_match('/^Pdo\\\\Dblib::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
43+
? new PDOException(\sprintf('Pdo\Dblib::connect() cannot be used for connecting to the "%s" driver', $matches[1]))
4444
: $e;
4545
}
4646
}

src/Php84/Resources/stubs/Pdo/Firebird.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public function __construct(string $dsn, ?string $username = null, ?string $pass
2424
{
2525
parent::__construct($dsn, $username, $password, $options);
2626

27-
if (($driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME)) !== 'firebird')
27+
if ('firebird' !== $driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME))
2828
{
29-
throw new PDOException("Pdo\Firebird::__construct() cannot be used for connecting to the \"$driver\" driver");
29+
throw new PDOException(\sprintf('Pdo\Firebird::__construct() cannot be used for connecting to the "%s" driver', $driver));
3030
}
3131
}
3232

@@ -35,8 +35,8 @@ public static function connect(string $dsn, ?string $username = null, ?string $p
3535
try {
3636
return new self($dsn, $username, $password, $options);
3737
} catch (PDOException $e) {
38-
throw preg_match('/Pdo\\\\Firebird::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
39-
? new PDOException("Pdo\Firebird::connect() cannot be used for connecting to the \"{$matches[1]}\" driver")
38+
throw preg_match('/^Pdo\\\\Firebird::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
39+
? new PDOException(\sprintf('Pdo\Firebird::connect() cannot be used for connecting to the "%s" driver', $matches[1]))
4040
: $e;
4141
}
4242
}

src/Php84/Resources/stubs/Pdo/Mysql.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/Php84/Resources/stubs/Pdo/Odbc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public function __construct(string $dsn, ?string $username = null, ?string $pass
2626
{
2727
parent::__construct($dsn, $username, $password, $options);
2828

29-
if (($driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME)) !== 'odbc')
29+
if ('odbc' !== $driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME))
3030
{
31-
throw new PDOException("Pdo\Odbc::__construct() cannot be used for connecting to the \"$driver\" driver");
31+
throw new PDOException(\sprintf('Pdo\Odbc::__construct() cannot be used for connecting to the "%s" driver', $driver));
3232
}
3333
}
3434

@@ -37,8 +37,8 @@ public static function connect(string $dsn, ?string $username = null, ?string $p
3737
try {
3838
return new self($dsn, $username, $password, $options);
3939
} catch (PDOException $e) {
40-
throw preg_match('/Pdo\\\\Odbc::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
41-
? new PDOException("Pdo\Odbc::connect() cannot be used for connecting to the \"{$matches[1]}\" driver")
40+
throw preg_match('/^Pdo\\\\Odbc::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
41+
? new PDOException(\sprintf('Pdo\Odbc::connect() cannot be used for connecting to the "%s" driver', $matches[1]))
4242
: $e;
4343
}
4444
}

src/Php84/Resources/stubs/Pdo/Pgsql.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public function __construct(string $dsn, ?string $username = null, ?string $pass
2222
{
2323
parent::__construct($dsn, $username, $password, $options);
2424

25-
if (($driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME)) !== 'pgsql')
25+
if ('pgsql' !== $driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME))
2626
{
27-
throw new PDOException("Pdo\Pgsql::__construct() cannot be used for connecting to the \"$driver\" driver");
27+
throw new PDOException(\sprintf('Pdo\Pgsql::__construct() cannot be used for connecting to the "%s" driver', $driver));
2828
}
2929
}
3030

@@ -33,8 +33,8 @@ public static function connect(string $dsn, ?string $username = null, ?string $p
3333
try {
3434
return new self($dsn, $username, $password, $options);
3535
} catch (PDOException $e) {
36-
throw preg_match('/Pdo\\\\Pgsql::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
37-
? new PDOException("Pdo\Pgsql::connect() cannot be used for connecting to the \"{$matches[1]}\" driver")
36+
throw preg_match('/^Pdo\\\\Pgsql::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
37+
? new PDOException(\sprintf('Pdo\Pgsql::connect() cannot be used for connecting to the "%s" driver', $matches[1]))
3838
: $e;
3939
}
4040
}

src/Php84/Resources/stubs/Pdo/Sqlite.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public function __construct(string $dsn, ?string $username = null, ?string $pass
2828
{
2929
parent::__construct($dsn, $username, $password, $options);
3030

31-
if (($driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME)) !== 'sqlite')
31+
if ('sqlite' !== $driver = $this->getAttribute(PDO::ATTR_DRIVER_NAME))
3232
{
33-
throw new PDOException("Pdo\Sqlite::__construct() cannot be used for connecting to the \"$driver\" driver");
33+
throw new PDOException(\sprintf('Pdo\Sqlite::__construct() cannot be used for connecting to the "%s" driver', $driver));
3434
}
3535
}
3636

@@ -39,8 +39,8 @@ public static function connect(string $dsn, ?string $username = null, ?string $p
3939
try {
4040
return new self($dsn, $username, $password, $options);
4141
} catch (PDOException $e) {
42-
throw preg_match('/Pdo\\\\Sqlite::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
43-
? new PDOException("Pdo\Sqlite::connect() cannot be used for connecting to the \"{$matches[1]}\" driver")
42+
throw preg_match('/^Pdo\\\\Sqlite::__construct\(\) cannot be used for connecting to the "([a-z]+)" driver/', $e->getMessage(), $matches)
43+
? new PDOException(\sprintf('Pdo\Sqlite::connect() cannot be used for connecting to the "%s" driver', $matches[1]))
4444
: $e;
4545
}
4646
}

0 commit comments

Comments
 (0)