Skip to content

Commit eaf1ab7

Browse files
authored
[9.x] Bump DBAL to 2.12 (#35974)
* Bump DBAL to 2.12 * Fix invalid signatures * Remove conflict * inheritdoc * DocBlocks
1 parent 09a2336 commit eaf1ab7

13 files changed

+60
-24
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
},
8080
"require-dev": {
8181
"aws/aws-sdk-php": "^3.155",
82-
"doctrine/dbal": "^2.6|^3.0",
82+
"doctrine/dbal": "^2.12|^3.0",
8383
"filp/whoops": "^2.8",
8484
"guzzlehttp/guzzle": "^7.2",
8585
"league/flysystem-aws-s3-v3": "^2.0",
@@ -132,7 +132,7 @@
132132
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
133133
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.155).",
134134
"brianium/paratest": "Required to run tests in parallel (^6.0).",
135-
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
135+
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.12|^3.0).",
136136
"filp/whoops": "Required for friendly error pages in development (^2.8).",
137137
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
138138
"guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^7.2).",

src/Illuminate/Database/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ public function getDoctrineConnection()
920920
$this->doctrineConnection = new DoctrineConnection(array_filter([
921921
'pdo' => $this->getPdo(),
922922
'dbname' => $this->getDatabaseName(),
923-
'driver' => method_exists($driver, 'getName') ? $driver->getName() : null,
923+
'driver' => $driver->getName(),
924924
'serverVersion' => $this->getConfig('server_version'),
925925
]), $driver);
926926
}

src/Illuminate/Database/DBAL/TimestampType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Illuminate\Database\DBAL;
44

5-
use Doctrine\DBAL\DBALException;
5+
use Doctrine\DBAL\Exception as DBALException;
66
use Doctrine\DBAL\Platforms\AbstractPlatform;
77
use Doctrine\DBAL\Types\Type;
88

src/Illuminate/Database/MySqlConnection.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Illuminate\Database;
44

5-
use Doctrine\DBAL\Driver\PDOMySql\Driver as DoctrineDriver;
6-
use Doctrine\DBAL\Version;
75
use Illuminate\Database\PDO\MySqlDriver;
86
use Illuminate\Database\Query\Grammars\MySqlGrammar as QueryGrammar;
97
use Illuminate\Database\Query\Processors\MySqlProcessor;
@@ -84,10 +82,10 @@ protected function getDefaultPostProcessor()
8482
/**
8583
* Get the Doctrine DBAL driver.
8684
*
87-
* @return \Doctrine\DBAL\Driver\PDOMySql\Driver|\Illuminate\Database\PDO\MySqlDriver
85+
* @return \Illuminate\Database\PDO\MySqlDriver
8886
*/
8987
protected function getDoctrineDriver()
9088
{
91-
return class_exists(Version::class) ? new DoctrineDriver : new MySqlDriver;
89+
return new MySqlDriver;
9290
}
9391
}

src/Illuminate/Database/PDO/Concerns/ConnectsToDatabase.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ trait ConnectsToDatabase
1010
/**
1111
* Create a new database connection.
1212
*
13-
* @param array $params
13+
* @param mixed[] $params
14+
* @param string|null $username
15+
* @param string|null $password
16+
* @param mixed[] $driverOptions
1417
* @return \Illuminate\Database\PDO\Connection
1518
*/
16-
public function connect(array $params)
19+
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
1720
{
1821
if (! isset($params['pdo']) || ! $params['pdo'] instanceof PDO) {
1922
throw new \InvalidArgumentException('Laravel requires the "pdo" property to be set and be a PDO instance.');

src/Illuminate/Database/PDO/MySqlDriver.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@
88
class MySqlDriver extends AbstractMySQLDriver
99
{
1010
use ConnectsToDatabase;
11+
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
public function getName()
16+
{
17+
return 'pdo_mysql';
18+
}
1119
}

src/Illuminate/Database/PDO/PostgresDriver.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@
88
class PostgresDriver extends AbstractPostgreSQLDriver
99
{
1010
use ConnectsToDatabase;
11+
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
public function getName()
16+
{
17+
return 'pdo_pgsql';
18+
}
1119
}

src/Illuminate/Database/PDO/SQLiteDriver.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@
88
class SQLiteDriver extends AbstractSQLiteDriver
99
{
1010
use ConnectsToDatabase;
11+
12+
/**
13+
* {@inheritdoc}
14+
*/
15+
public function getName()
16+
{
17+
return 'pdo_sqlite';
18+
}
1119
}

src/Illuminate/Database/PDO/SqlServerDriver.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,27 @@
66

77
class SqlServerDriver extends AbstractSQLServerDriver
88
{
9-
public function connect(array $params)
9+
/**
10+
* Create a new database connection.
11+
*
12+
* @param mixed[] $params
13+
* @param string|null $username
14+
* @param string|null $password
15+
* @param mixed[] $driverOptions
16+
* @return \Illuminate\Database\PDO\Connection
17+
*/
18+
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
1019
{
1120
return new SqlServerConnection(
1221
new Connection($params['pdo'])
1322
);
1423
}
24+
25+
/**
26+
* {@inheritdoc}
27+
*/
28+
public function getName()
29+
{
30+
return 'pdo_sqlsrv';
31+
}
1532
}

src/Illuminate/Database/PostgresConnection.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Illuminate\Database;
44

5-
use Doctrine\DBAL\Driver\PDOPgSql\Driver as DoctrineDriver;
6-
use Doctrine\DBAL\Version;
75
use Illuminate\Database\PDO\PostgresDriver;
86
use Illuminate\Database\Query\Grammars\PostgresGrammar as QueryGrammar;
97
use Illuminate\Database\Query\Processors\PostgresProcessor;
@@ -99,10 +97,10 @@ protected function getDefaultPostProcessor()
9997
/**
10098
* Get the Doctrine DBAL driver.
10199
*
102-
* @return \Doctrine\DBAL\Driver\PDOPgSql\Driver|\Illuminate\Database\PDO\PostgresDriver
100+
* @return \Illuminate\Database\PDO\PostgresDriver
103101
*/
104102
protected function getDoctrineDriver()
105103
{
106-
return class_exists(Version::class) ? new DoctrineDriver : new PostgresDriver;
104+
return new PostgresDriver;
107105
}
108106
}

0 commit comments

Comments
 (0)