Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 282f479

Browse filesBrowse files
committed
minor #43311 [Cache][Doctrine][DoctrineBridge][Lock][Messenger] Remove references to DBALException (derrabus)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache][Doctrine][DoctrineBridge][Lock][Messenger] Remove references to `DBALException` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Bumping DBAL to 2.13 allows us to simplify some code. Commits ------- bcb6e96 Remove references to DBALException
2 parents a9810e0 + bcb6e96 commit 282f479
Copy full SHA for 282f479

File tree

13 files changed

+35
-56
lines changed
Filter options

13 files changed

+35
-56
lines changed

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"doctrine/cache": "^1.11|^2.0",
130130
"doctrine/collections": "~1.0",
131131
"doctrine/data-fixtures": "^1.1",
132-
"doctrine/dbal": "^2.10|^3.0",
132+
"doctrine/dbal": "^2.13|^3.0",
133133
"doctrine/orm": "^2.7.3",
134134
"guzzlehttp/promises": "^1.4",
135135
"masterminds/html5": "^2.6",
@@ -155,7 +155,7 @@
155155
"ext-psr": "<1.1|>=2",
156156
"async-aws/core": "<1.5",
157157
"doctrine/annotations": "<1.13.1",
158-
"doctrine/dbal": "<2.10",
158+
"doctrine/dbal": "<2.13",
159159
"egulias/email-validator": "~3.0.0",
160160
"masterminds/html5": "<2.6",
161161
"phpdocumentor/reflection-docblock": "<3.2.2",

‎src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Messenger/DoctrinePingConnectionMiddleware.php
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Messenger;
1313

14-
use Doctrine\DBAL\DBALException;
15-
use Doctrine\DBAL\Exception;
14+
use Doctrine\DBAL\Exception as DBALException;
1615
use Doctrine\ORM\EntityManagerInterface;
1716
use Symfony\Component\Messenger\Envelope;
1817
use Symfony\Component\Messenger\Middleware\StackInterface;
@@ -40,7 +39,7 @@ private function pingConnection(EntityManagerInterface $entityManager)
4039

4140
try {
4241
$connection->executeQuery($connection->getDatabasePlatform()->getDummySelectSQL());
43-
} catch (DBALException | Exception $e) {
42+
} catch (DBALException $e) {
4443
$connection->close();
4544
$connection->connect();
4645
}

‎src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
namespace Symfony\Bridge\Doctrine\Tests\Messenger;
1313

1414
use Doctrine\DBAL\Connection;
15-
use Doctrine\DBAL\DBALException;
16-
use Doctrine\DBAL\Exception;
15+
use Doctrine\DBAL\Exception as DBALException;
1716
use Doctrine\ORM\EntityManagerInterface;
1817
use Doctrine\Persistence\ManagerRegistry;
1918
use Symfony\Bridge\Doctrine\Messenger\DoctrinePingConnectionMiddleware;
@@ -50,7 +49,7 @@ public function testMiddlewarePingOk()
5049
{
5150
$this->connection->expects($this->once())
5251
->method('getDatabasePlatform')
53-
->will($this->throwException(class_exists(Exception::class) ? new Exception() : new DBALException()));
52+
->will($this->throwException(new DBALException()));
5453

5554
$this->connection->expects($this->once())
5655
->method('close')
@@ -69,7 +68,7 @@ public function testMiddlewarePingResetEntityManager()
6968
{
7069
$this->connection->expects($this->once())
7170
->method('getDatabasePlatform')
72-
->will($this->throwException(class_exists(Exception::class) ? new Exception() : new DBALException()));
71+
->will($this->throwException(new DBALException()));
7372

7473
$this->entityManager->expects($this->once())
7574
->method('isOpen')

‎src/Symfony/Bridge/Doctrine/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
"doctrine/annotations": "^1.10.4",
4848
"doctrine/collections": "~1.0",
4949
"doctrine/data-fixtures": "^1.1",
50-
"doctrine/dbal": "^2.10|^3.0",
50+
"doctrine/dbal": "^2.13|^3.0",
5151
"doctrine/orm": "^2.7.3"
5252
},
5353
"conflict": {
54-
"doctrine/dbal": "<2.10",
54+
"doctrine/dbal": "<2.13",
5555
"doctrine/orm": "<2.7.3",
5656
"phpunit/phpunit": "<5.4.3",
5757
"symfony/dependency-injection": "<4.4",

‎src/Symfony/Component/Cache/Adapter/PdoAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/PdoAdapter.php
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
namespace Symfony\Component\Cache\Adapter;
1313

1414
use Doctrine\DBAL\Connection;
15-
use Doctrine\DBAL\DBALException;
1615
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
1716
use Doctrine\DBAL\DriverManager;
18-
use Doctrine\DBAL\Exception;
17+
use Doctrine\DBAL\Exception as DBALException;
1918
use Doctrine\DBAL\Exception\TableNotFoundException;
2019
use Doctrine\DBAL\ParameterType;
2120
use Doctrine\DBAL\Schema\Schema;
@@ -110,7 +109,6 @@ public function __construct($connOrDsn, string $namespace = '', int $defaultLife
110109
*
111110
* @throws \PDOException When the table already exists
112111
* @throws DBALException When the table already exists
113-
* @throws Exception When the table already exists
114112
* @throws \DomainException When an unsupported PDO driver is used
115113
*/
116114
public function createTable()
@@ -437,7 +435,7 @@ protected function doSave(array $values, int $lifetime)
437435
if (null === $driver && !(\is_object($result) ? $result->rowCount() : $stmt->rowCount())) {
438436
try {
439437
$insertStmt->execute();
440-
} catch (DBALException | Exception $e) {
438+
} catch (DBALException $e) {
441439
} catch (\PDOException $e) {
442440
// A concurrent write won, let it be
443441
}

‎src/Symfony/Component/Cache/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"require-dev": {
3535
"cache/integration-tests": "dev-master",
3636
"doctrine/cache": "^1.6|^2.0",
37-
"doctrine/dbal": "^2.10|^3.0",
37+
"doctrine/dbal": "^2.13|^3.0",
3838
"predis/predis": "^1.1",
3939
"psr/simple-cache": "^1.0",
4040
"symfony/config": "^4.4|^5.0|^6.0",
@@ -45,7 +45,7 @@
4545
"symfony/var-dumper": "^4.4|^5.0|^6.0"
4646
},
4747
"conflict": {
48-
"doctrine/dbal": "<2.10",
48+
"doctrine/dbal": "<2.13",
4949
"symfony/dependency-injection": "<4.4",
5050
"symfony/http-kernel": "<4.4",
5151
"symfony/var-dumper": "<4.4"

‎src/Symfony/Component/Lock/Store/PdoStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/PdoStore.php
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
namespace Symfony\Component\Lock\Store;
1313

1414
use Doctrine\DBAL\Connection;
15-
use Doctrine\DBAL\DBALException;
1615
use Doctrine\DBAL\DriverManager;
17-
use Doctrine\DBAL\Exception;
16+
use Doctrine\DBAL\Exception as DBALException;
1817
use Doctrine\DBAL\Exception\TableNotFoundException;
1918
use Doctrine\DBAL\Schema\Schema;
2019
use Symfony\Component\Lock\Exception\InvalidArgumentException;
@@ -144,7 +143,7 @@ public function save(Key $key)
144143
$this->createTable();
145144
}
146145
$stmt->execute();
147-
} catch (DBALException | Exception $e) {
146+
} catch (DBALException $e) {
148147
// the lock is already acquired. It could be us. Let's try to put off.
149148
$this->putOffExpiration($key, $this->initialTtl);
150149
} catch (\PDOException $e) {
@@ -258,7 +257,6 @@ private function getConnection(): object
258257
*
259258
* @throws \PDOException When the table already exists
260259
* @throws DBALException When the table already exists
261-
* @throws Exception When the table already exists
262260
* @throws \DomainException When an unsupported PDO driver is used
263261
*/
264262
public function createTable(): void

‎src/Symfony/Component/Lock/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
"symfony/polyfill-php80": "^1.16"
2323
},
2424
"require-dev": {
25-
"doctrine/dbal": "^2.10|^3.0",
25+
"doctrine/dbal": "^2.13|^3.0",
2626
"mongodb/mongodb": "~1.1",
2727
"predis/predis": "~1.0"
2828
},
2929
"conflict": {
30-
"doctrine/dbal": "<2.10"
30+
"doctrine/dbal": "<2.13"
3131
},
3232
"autoload": {
3333
"psr-4": { "Symfony\\Component\\Lock\\": "" },

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php
+3-14Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
use Doctrine\DBAL\Abstraction\Result as AbstractionResult;
1515
use Doctrine\DBAL\Configuration;
1616
use Doctrine\DBAL\Connection as DBALConnection;
17-
use Doctrine\DBAL\DBALException;
1817
use Doctrine\DBAL\Driver\Result as DriverResult;
1918
use Doctrine\DBAL\Driver\ResultStatement;
20-
use Doctrine\DBAL\Exception;
19+
use Doctrine\DBAL\Exception as DBALException;
2120
use Doctrine\DBAL\Platforms\AbstractPlatform;
2221
use Doctrine\DBAL\Platforms\MySQL57Platform;
2322
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
@@ -100,12 +99,7 @@ public function testItThrowsATransportExceptionIfItCannotAcknowledgeMessage()
10099
{
101100
$this->expectException(TransportException::class);
102101
$driverConnection = $this->getDBALConnectionMock();
103-
104-
if (class_exists(Exception::class)) {
105-
$driverConnection->method('delete')->willThrowException(new Exception());
106-
} else {
107-
$driverConnection->method('delete')->willThrowException(new DBALException());
108-
}
102+
$driverConnection->method('delete')->willThrowException(new DBALException());
109103

110104
$connection = new Connection([], $driverConnection);
111105
$connection->ack('dummy_id');
@@ -115,12 +109,7 @@ public function testItThrowsATransportExceptionIfItCannotRejectMessage()
115109
{
116110
$this->expectException(TransportException::class);
117111
$driverConnection = $this->getDBALConnectionMock();
118-
119-
if (class_exists(Exception::class)) {
120-
$driverConnection->method('delete')->willThrowException(new Exception());
121-
} else {
122-
$driverConnection->method('delete')->willThrowException(new DBALException());
123-
}
112+
$driverConnection->method('delete')->willThrowException(new DBALException());
124113

125114
$connection = new Connection([], $driverConnection);
126115
$connection->reject('dummy_id');

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;
1313

1414
use Doctrine\DBAL\Connection as DBALConnection;
15-
use Doctrine\DBAL\DBALException;
1615
use Doctrine\DBAL\Driver\Result as DriverResult;
17-
use Doctrine\DBAL\Exception;
16+
use Doctrine\DBAL\Exception as DBALException;
1817
use Doctrine\DBAL\Exception\TableNotFoundException;
1918
use Doctrine\DBAL\LockMode;
2019
use Doctrine\DBAL\Platforms\MySqlPlatform;
@@ -118,8 +117,7 @@ public static function buildConfiguration(string $dsn, array $options = []): arr
118117
*
119118
* @return string The inserted id
120119
*
121-
* @throws \Doctrine\DBAL\DBALException
122-
* @throws \Doctrine\DBAL\Exception
120+
* @throws DBALException
123121
*/
124122
public function send(string $body, array $headers, int $delay = 0): string
125123
{
@@ -227,7 +225,7 @@ public function ack(string $id): bool
227225
{
228226
try {
229227
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
230-
} catch (DBALException | Exception $exception) {
228+
} catch (DBALException $exception) {
231229
throw new TransportException($exception->getMessage(), 0, $exception);
232230
}
233231
}
@@ -236,7 +234,7 @@ public function reject(string $id): bool
236234
{
237235
try {
238236
return $this->driverConnection->delete($this->configuration['table_name'], ['id' => $id]) > 0;
239-
} catch (DBALException | Exception $exception) {
237+
} catch (DBALException $exception) {
240238
throw new TransportException($exception->getMessage(), 0, $exception);
241239
}
242240
}

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineReceiver.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineReceiver.php
+7-8Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;
1313

14-
use Doctrine\DBAL\DBALException;
15-
use Doctrine\DBAL\Exception;
14+
use Doctrine\DBAL\Exception as DBALException;
1615
use Doctrine\DBAL\Exception\RetryableException;
1716
use Symfony\Component\Messenger\Envelope;
1817
use Symfony\Component\Messenger\Exception\LogicException;
@@ -59,7 +58,7 @@ public function get(): iterable
5958
}
6059

6160
return [];
62-
} catch (DBALException | Exception $exception) {
61+
} catch (DBALException $exception) {
6362
throw new TransportException($exception->getMessage(), 0, $exception);
6463
}
6564

@@ -77,7 +76,7 @@ public function ack(Envelope $envelope): void
7776
{
7877
try {
7978
$this->connection->ack($this->findDoctrineReceivedStamp($envelope)->getId());
80-
} catch (DBALException | Exception $exception) {
79+
} catch (DBALException $exception) {
8180
throw new TransportException($exception->getMessage(), 0, $exception);
8281
}
8382
}
@@ -89,7 +88,7 @@ public function reject(Envelope $envelope): void
8988
{
9089
try {
9190
$this->connection->reject($this->findDoctrineReceivedStamp($envelope)->getId());
92-
} catch (DBALException | Exception $exception) {
91+
} catch (DBALException $exception) {
9392
throw new TransportException($exception->getMessage(), 0, $exception);
9493
}
9594
}
@@ -101,7 +100,7 @@ public function getMessageCount(): int
101100
{
102101
try {
103102
return $this->connection->getMessageCount();
104-
} catch (DBALException | Exception $exception) {
103+
} catch (DBALException $exception) {
105104
throw new TransportException($exception->getMessage(), 0, $exception);
106105
}
107106
}
@@ -113,7 +112,7 @@ public function all(int $limit = null): iterable
113112
{
114113
try {
115114
$doctrineEnvelopes = $this->connection->findAll($limit);
116-
} catch (DBALException | Exception $exception) {
115+
} catch (DBALException $exception) {
117116
throw new TransportException($exception->getMessage(), 0, $exception);
118117
}
119118

@@ -129,7 +128,7 @@ public function find($id): ?Envelope
129128
{
130129
try {
131130
$doctrineEnvelope = $this->connection->find($id);
132-
} catch (DBALException | Exception $exception) {
131+
} catch (DBALException $exception) {
133132
throw new TransportException($exception->getMessage(), 0, $exception);
134133
}
135134

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineSender.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineSender.php
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
namespace Symfony\Component\Messenger\Bridge\Doctrine\Transport;
1313

14-
use Doctrine\DBAL\DBALException;
15-
use Doctrine\DBAL\Exception;
14+
use Doctrine\DBAL\Exception as DBALException;
1615
use Symfony\Component\Messenger\Envelope;
1716
use Symfony\Component\Messenger\Exception\TransportException;
1817
use Symfony\Component\Messenger\Stamp\DelayStamp;
@@ -48,7 +47,7 @@ public function send(Envelope $envelope): Envelope
4847

4948
try {
5049
$id = $this->connection->send($encodedMessage['body'], $encodedMessage['headers'] ?? [], $delay);
51-
} catch (DBALException | Exception $exception) {
50+
} catch (DBALException $exception) {
5251
throw new TransportException($exception->getMessage(), 0, $exception);
5352
}
5453

‎src/Symfony/Component/Messenger/Bridge/Doctrine/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
"symfony/service-contracts": "^1.1|^2"
2222
},
2323
"require-dev": {
24-
"doctrine/dbal": "^2.10|^3.0",
24+
"doctrine/dbal": "^2.13|^3.0",
2525
"doctrine/persistence": "^1.3|^2",
2626
"symfony/property-access": "^4.4|^5.0|^6.0",
2727
"symfony/serializer": "^4.4|^5.0|^6.0"
2828
},
2929
"conflict": {
30-
"doctrine/dbal": "<2.10",
30+
"doctrine/dbal": "<2.13",
3131
"doctrine/persistence": "<1.3"
3232
},
3333
"autoload": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.