Skip to content

Commit

Permalink
Improve the compatibility layer for Doctrine DBAL to avoid side-effec…
Browse files Browse the repository at this point in the history
…ts 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`
  • Loading branch information
ste93cry committed Sep 17, 2021
1 parent 31edf15 commit be6339f
Show file tree
Hide file tree
Showing 15 changed files with 557 additions and 521 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

## 4.2.2 (2021-08-30)

Expand Down
85 changes: 0 additions & 85 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,56 +15,6 @@ parameters:
count: 1
path: src/EventListener/ErrorListener.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:connect\\(\\)\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getDatabasePlatform\\(\\)\\.$#"
count: 2
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\|Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:getSchemaManager\\(\\)\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\Compatibility\\\\ExceptionConverterDriverInterface\\:\\:convertException\\(\\)\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$driverOptions with no value type specified in iterable type array\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$password with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:connect\\(\\) has parameter \\$username with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:convertException\\(\\) has parameter \\$message with no typehint specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Parameter \\#2 \\$query of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Query\\|null, Doctrine\\\\DBAL\\\\Driver\\\\DriverException given\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Parameter \\$exception of method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriver\\:\\:convertException\\(\\) has invalid typehint type Doctrine\\\\DBAL\\\\Driver\\\\DriverException\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriver.php

-
message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Driver\\\\Connection\\:\\:errorCode\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -220,41 +170,6 @@ parameters:
count: 1
path: tests/Tracing/Cache/AbstractTraceableCacheAdapterTest.php

-
message: "#^Class Doctrine\\\\DBAL\\\\Driver\\\\DriverException not found\\.$#"
count: 3
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Parameter \\#1 \\$driverException of class Doctrine\\\\DBAL\\\\Exception\\\\DriverException constructor expects Doctrine\\\\DBAL\\\\Driver\\\\Exception, string given\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Parameter \\#1 \\$originalClassName of method PHPUnit\\\\Framework\\\\TestCase\\:\\:createMock\\(\\) expects class\\-string\\<Doctrine\\\\DBAL\\\\Driver\\\\DriverException\\>, string given\\.$#"
count: 2
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
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\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Trying to mock an undefined method convertException\\(\\) on class Sentry\\\\SentryBundle\\\\Tests\\\\Tracing\\\\Doctrine\\\\DBAL\\\\StubExceptionConverterDriverInterface\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Trying to mock an undefined method getDatabase\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Trying to mock an undefined method getName\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverTest.php

-
message: "#^Trying to mock an undefined method closeCursor\\(\\) on class Doctrine\\\\DBAL\\\\Driver\\\\Statement\\.$#"
count: 1
Expand Down
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ parameters:
excludePaths:
- src/aliases.php
- src/Tracing/Doctrine/DBAL/TracingStatementForV2.php
- src/Tracing/Doctrine/DBAL/TracingDriverForV2.php
- tests/End2End/App
- tests/Tracing/Doctrine/DBAL/TracingDriverForV2Test.php
dynamicConstantNames:
- Symfony\Component\HttpKernel\Kernel::VERSION
- Symfony\Component\HttpKernel\Kernel::VERSION_ID
Expand Down
10 changes: 9 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.9.3@4c262932602b9bbab5020863d1eb22d49de0dbf4">
<files psalm-version="4.10.0@916b098b008f6de4543892b1e0651c1c3b92cbfa">
<file src="src/EventListener/ConsoleCommandListener.php">
<InvalidExtendClass occurrences="1">
<code>ConsoleListener</code>
Expand All @@ -8,6 +8,11 @@
<code>public function __construct(HubInterface $hub, bool $captureErrors = true)</code>
</MethodSignatureMismatch>
</file>
<file src="src/Tracing/Doctrine/DBAL/TracingDriverForV2.php">
<UndefinedClass occurrences="1">
<code>ExceptionConverterDriver</code>
</UndefinedClass>
</file>
<file src="src/Tracing/Doctrine/DBAL/TracingStatementForV2.php">
<InvalidReturnStatement occurrences="2">
<code>$this-&gt;decoratedStatement</code>
Expand All @@ -33,6 +38,9 @@
</UndefinedInterfaceMethod>
</file>
<file src="src/aliases.php">
<MissingDependency occurrences="1">
<code>TracingDriverForV2</code>
</MissingDependency>
<UndefinedClass occurrences="6">
<code>FilterControllerEvent</code>
<code>FilterResponseEvent</code>
Expand Down

This file was deleted.

140 changes: 0 additions & 140 deletions src/Tracing/Doctrine/DBAL/TracingDriver.php

This file was deleted.

Loading

0 comments on commit be6339f

Please sign in to comment.