Skip to content

Commit be6339f

Browse files
authored
Improve the compatibility layer for Doctrine DBAL to avoid side-effects of polyfilling (#553)
* Improve the compatibility layer for Doctrine DBAL to avoid deprecations * Update the CHANGELOG file * Mark the `TracingDriver*` and `TracingStatement*` classes as `@internal`
1 parent 31edf15 commit be6339f

15 files changed

+557
-521
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Fix: Test if `TracingStatement` exists before attempting to create the class alias, otherwise it breaks when opcache is enabled. (#552)
66
- Fix: Pass logger from `logger` config option to `TransportFactory` (#555)
7+
- Improve the compatibility layer with Doctrine DBAL to avoid deprecations notices (#553)
78

89
## 4.2.2 (2021-08-30)
910

phpstan-baseline.neon

-85
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,6 @@ parameters:
1515
count: 1
1616
path: src/EventListener/ErrorListener.php
1717

18-
-
19-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:connect\\(\\)\\.$#"
20-
count: 1
21-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
22-
23-
-
24-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getDatabasePlatform\\(\\)\\.$#"
25-
count: 2
26-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
27-
28-
-
29-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getSchemaManager\\(\\)\\.$#"
30-
count: 1
31-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
32-
33-
-
34-
message: "#^Call to an undefined method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:convertException\\(\\)\\.$#"
35-
count: 1
36-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
37-
38-
-
39-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$driverOptions with no value type specified in iterable type array\\.$#"
40-
count: 1
41-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
42-
43-
-
44-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$password with no typehint specified\\.$#"
45-
count: 1
46-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
47-
48-
-
49-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$username with no typehint specified\\.$#"
50-
count: 1
51-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
52-
53-
-
54-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:convertException\\(\\) has parameter \\$message with no typehint specified\\.$#"
55-
count: 1
56-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
57-
58-
-
59-
message: "#^Parameter \\#2 \\$query of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Query\\|null, Doctrine\\\\DBAL\\\\Driver\\\\DriverException given\\.$#"
60-
count: 1
61-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
62-
63-
-
64-
message: "#^Parameter \\$exception of method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:convertException\\(\\) has invalid typehint type Doctrine\\\\DBAL\\\\Driver\\\\DriverException\\.$#"
65-
count: 1
66-
path: src/Tracing/Doctrine/DBAL/TracingDriver.php
67-
6818
-
6919
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\\\Connection\\:\\:errorCode\\(\\)\\.$#"
7020
count: 1
@@ -220,41 +170,6 @@ parameters:
220170
count: 1
221171
path: tests/Tracing/Cache/AbstractTraceableCacheAdapterTest.php
222172

223-
-
224-
message: "#^Class Doctrine\\\\DBAL\\\\Driver\\\\DriverException not found\\.$#"
225-
count: 3
226-
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
227-
228-
-
229-
message: "#^Parameter \\#1 \\$driverException of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Driver\\\\Exception, string given\\.$#"
230-
count: 1
231-
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
232-
233-
-
234-
message: "#^Parameter \\#1 \\$originalClassName of method PHPUnit\\\\Framework\\\\TestCase\\:\\:createMock\\(\\) expects class\\-string\\<Doctrine\\\\DBAL\\\\Driver\\\\DriverException\\>, string given\\.$#"
235-
count: 2
236-
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
237-
238-
-
239-
message: "#^Parameter \\#2 \\$query of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Query\\|null, Doctrine\\\\DBAL\\\\Driver\\\\DriverException&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject given\\.$#"
240-
count: 1
241-
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
242-
243-
-
244-
message: "#^Trying to mock an undefined method convertException\\(\\) on class Sentry\\\\SentryBundle\\\\Tests\\\\Tracing\\\\Doctrine\\\\DBAL\\\\StubExceptionConverterDriverInterface\\.$#"
245-
count: 1
246-
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
247-
248-
-
249-
message: "#^Trying to mock an undefined method getDatabase\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
250-
count: 1
251-
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
252-
253-
-
254-
message: "#^Trying to mock an undefined method getName\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
255-
count: 1
256-
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php
257-
258173
-
259174
message: "#^Trying to mock an undefined method closeCursor\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\\\Statement\\.$#"
260175
count: 1

phpstan.neon

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ parameters:
1111
excludePaths:
1212
- src/aliases.php
1313
- src/Tracing/Doctrine/DBAL/TracingStatementForV2.php
14+
- src/Tracing/Doctrine/DBAL/TracingDriverForV2.php
1415
- tests/End2End/App
16+
- tests/Tracing/Doctrine/DBAL/TracingDriverForV2Test.php
1517
dynamicConstantNames:
1618
- Symfony\Component\HttpKernel\Kernel::VERSION
1719
- Symfony\Component\HttpKernel\Kernel::VERSION_ID

psalm-baseline.xml

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.9.3@4c262932602b9bbab5020863d1eb22d49de0dbf4">
2+
<files psalm-version="4.10.0@916b098b008f6de4543892b1e0651c1c3b92cbfa">
33
<file src="src/EventListener/ConsoleCommandListener.php">
44
<InvalidExtendClass occurrences="1">
55
<code>ConsoleListener</code>
@@ -8,6 +8,11 @@
88
<code>public function __construct(HubInterface $hub, bool $captureErrors = true)</code>
99
</MethodSignatureMismatch>
1010
</file>
11+
<file src="src/Tracing/Doctrine/DBAL/TracingDriverForV2.php">
12+
<UndefinedClass occurrences="1">
13+
<code>ExceptionConverterDriver</code>
14+
</UndefinedClass>
15+
</file>
1116
<file src="src/Tracing/Doctrine/DBAL/TracingStatementForV2.php">
1217
<InvalidReturnStatement occurrences="2">
1318
<code>$this-&gt;decoratedStatement</code>
@@ -33,6 +38,9 @@
3338
</UndefinedInterfaceMethod>
3439
</file>
3540
<file src="src/aliases.php">
41+
<MissingDependency occurrences="1">
42+
<code>TracingDriverForV2</code>
43+
</MissingDependency>
3644
<UndefinedClass occurrences="6">
3745
<code>FilterControllerEvent</code>
3846
<code>FilterResponseEvent</code>

src/Tracing/Doctrine/DBAL/Compatibility/ExceptionConverterDriverInterface.php

-12
This file was deleted.

src/Tracing/Doctrine/DBAL/TracingDriver.php

-140
This file was deleted.

0 commit comments

Comments
 (0)