Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add support for doctrine/dbal v4.0 #811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"symfony/security-http": "^4.4.20||^5.0.11||^6.0||^7.0"
},
"require-dev": {
"doctrine/dbal": "^2.13||^3.3",
"doctrine/dbal": "^2.13||^3.3||^4.0",
"doctrine/doctrine-bundle": "^2.6",
"friendsofphp/php-cs-fixer": "^2.19||^3.40",
"masterminds/html5": "^2.8",
Expand Down
141 changes: 18 additions & 123 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -176,74 +176,34 @@ parameters:
path: src/Tracing/Doctrine/DBAL/ConnectionConfigurator.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:errorInfo\\(\\) return type has no value type specified in iterable type array\\.$#"
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnectionForV4\\:\\:errorInfo\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
path: src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:exec\\(\\) has parameter \\$sql with no type specified\\.$#"
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnectionForV4\\:\\:exec\\(\\) should return int\\|numeric\\-string but returns int\\|string\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
path: src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:prepare\\(\\) has parameter \\$sql with no type specified\\.$#"
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnectionForV4\\:\\:prepare\\(\\) has parameter \\$sql with no type specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
path: src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:query\\(\\) has parameter \\$args with no type specified\\.$#"
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnectionForV4\\:\\:query\\(\\) has parameter \\$args with no type specified\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
path: src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php

-
message: "#^Parameter \\#1 \\$sql of method Doctrine\\\\DBAL\\\\Driver\\\\Connection\\:\\:query\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php
path: src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php

-
message: "#^Parameter \\#2 \\$spanDescription of method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:traceFunction\\(\\) expects string, string\\|null given\\.$#"
message: "#^Parameter \\#2 \\$spanDescription of method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnectionForV4\\:\\:traceFunction\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Property Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnection\\:\\:\\$spanTags is never read, only written\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingDriverConnection.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingServerInfoAwareDriverConnection\\:\\:errorInfo\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php

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

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

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

-
message: "#^Parameter \\#1 \\$sql of method Doctrine\\\\DBAL\\\\Driver\\\\Connection\\:\\:query\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php

-
message: "#^Parameter \\#2 \\$callback of method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\AbstractTracingStatement\\:\\:traceFunction\\(\\) expects callable\\(mixed \\.\\.\\.\\)\\: Doctrine\\\\DBAL\\\\Driver\\\\Result, array\\{Doctrine\\\\DBAL\\\\Driver\\\\Statement, 'execute'\\} given\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingStatementForV3.php

-
message: "#^Parameter \\#4 \\$length of method Doctrine\\\\DBAL\\\\Driver\\\\Statement\\:\\:bindParam\\(\\) expects int\\|null, mixed given\\.$#"
count: 1
path: src/Tracing/Doctrine/DBAL/TracingStatementForV3.php
path: src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV4.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Tracing\\\\HttpClient\\\\AbstractTraceableHttpClient\\:\\:request\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
Expand Down Expand Up @@ -425,91 +385,26 @@ parameters:
count: 1
path: tests/Tracing/Cache/AbstractTraceableCacheAdapterTest.php

-
message: "#^Property Sentry\\\\SentryBundle\\\\Tests\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnectionFactoryV4Test\\:\\:\\$databasePlatform is never read, only written\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverConnectionFactoryV4Test.php

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

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

-
message: "#^Parameter \\#1 \\$hubOrConnectionFactory of class Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverMiddleware constructor expects Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingDriverConnectionFactoryInterface\\|Sentry\\\\State\\\\HubInterface, null given\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingDriverMiddlewareTest.php

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

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

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

-
message: "#^Parameter \\#2 \\$decoratedStatement of class Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingStatementForV2 constructor expects Doctrine\\\\DBAL\\\\Driver\\\\Statement, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Sentry\\\\SentryBundle\\\\Tests\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingStatementForV2Stub given\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingStatementForV2Test.php

-
message: "#^Parameter \\#4 \\$length of method Sentry\\\\SentryBundle\\\\Tracing\\\\Doctrine\\\\DBAL\\\\TracingStatementForV2\\:\\:bindParam\\(\\) expects int\\|null, mixed given\\.$#"
count: 1
path: tests/Tracing/Doctrine/DBAL/TracingStatementForV2Test.php

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

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

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

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

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

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

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

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

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

-
message: "#^Parameter \\#1 \\$responses of method Sentry\\\\SentryBundle\\\\Tracing\\\\HttpClient\\\\AbstractTraceableHttpClient\\:\\:stream\\(\\) expects iterable\\<\\(int\\|string\\), Symfony\\\\Contracts\\\\HttpClient\\\\ResponseInterface\\>\\|Symfony\\\\Contracts\\\\HttpClient\\\\ResponseInterface, stdClass given\\.$#"
count: 1
Expand Down
14 changes: 13 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,26 @@ parameters:
- src/aliases.php
- src/Tracing/Cache/TraceableCacheAdapterForV2.php
- src/Tracing/Cache/TraceableTagAwareCacheAdapterForV2.php
- src/Tracing/Doctrine/DBAL/TracingStatementForV2.php
- src/Tracing/Doctrine/DBAL/TracingDriverConnectionFactoryForV2V3.php
- src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV2V3.php
- src/Tracing/Doctrine/DBAL/TracingDriverForV2.php
- src/Tracing/Doctrine/DBAL/TracingDriverForV3.php
- src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php
- src/Tracing/Doctrine/DBAL/TracingStatementForV2.php
- src/Tracing/Doctrine/DBAL/TracingStatementForV3.php
- src/Tracing/HttpClient/TraceableHttpClientForV4.php
- src/Tracing/HttpClient/TraceableHttpClientForV5.php
- src/Tracing/HttpClient/TraceableResponseForV4.php
- src/Tracing/HttpClient/TraceableResponseForV5.php
- tests/End2End/App
- tests/Tracing/Doctrine/DBAL/TracingDriverConnectionFactoryV2Test.php
- tests/Tracing/Doctrine/DBAL/TracingDriverConnectionFactoryV3Test.php
- tests/Tracing/Doctrine/DBAL/TracingDriverConnectionForV2V3Test.php
- tests/Tracing/Doctrine/DBAL/TracingDriverForV2Test.php
- tests/Tracing/Doctrine/DBAL/TracingDriverForV3Test.php
- tests/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnectionTest.php
- tests/Tracing/Doctrine/DBAL/TracingStatementForV2Test.php
- tests/Tracing/Doctrine/DBAL/TracingStatementForV3Test.php
- tests/EventListener/Fixtures/UserWithoutIdentifierStub.php
dynamicConstantNames:
- Symfony\Component\HttpKernel\Kernel::VERSION
Expand Down
101 changes: 33 additions & 68 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,95 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<files psalm-version="5.22.2@d768d914152dbbf3486c36398802f74e80cfde48">
<file src="src/DependencyInjection/SentryExtension.php">
<UndefinedClass occurrences="1">
<code>FatalErrorException</code>
<UndefinedClass>
<code><![CDATA[FatalErrorException]]></code>
</UndefinedClass>
</file>
<file src="src/EventListener/ConsoleCommandListener.php">
<InvalidExtendClass occurrences="1">
<code>ConsoleListener</code>
<InvalidExtendClass>
<code><![CDATA[ConsoleListener]]></code>
</InvalidExtendClass>
<MethodSignatureMismatch occurrences="1">
<code>public function __construct(HubInterface $hub, bool $captureErrors = true)</code>
<MethodSignatureMismatch>
<code><![CDATA[public function __construct(HubInterface $hub, bool $captureErrors = true)]]></code>
</MethodSignatureMismatch>
</file>
<file src="src/EventListener/ErrorListener.php">
<RedundantCondition occurrences="1">
<code>$event instanceof ExceptionEvent</code>
</RedundantCondition>
<UndefinedMethod occurrences="1">
<code>getException</code>
</UndefinedMethod>
</file>
<file src="src/EventListener/KernelEventForwardCompatibilityTrait.php">
<UndefinedMethod occurrences="1">
<code>isMasterRequest</code>
<UndefinedMethod>
<code><![CDATA[isMasterRequest]]></code>
</UndefinedMethod>
</file>
<file src="src/Tracing/Cache/TraceableCacheAdapterTrait.php">
<LessSpecificImplementedReturnType occurrences="1">
<code>iterable</code>
<LessSpecificImplementedReturnType>
<code><![CDATA[iterable]]></code>
</LessSpecificImplementedReturnType>
</file>
<file src="src/Tracing/Doctrine/DBAL/Compatibility/MiddlewareInterface.php">
<UnrecognizedStatement occurrences="1"/>
</file>
<file src="src/Tracing/Doctrine/DBAL/TracingDriverForV2.php">
<UndefinedClass occurrences="1">
<code>ExceptionConverterDriver</code>
</UndefinedClass>
</file>
<file src="src/Tracing/Doctrine/DBAL/TracingDriverForV3.php">
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;decoratedDriver-&gt;getSchemaManager($conn, $platform)</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>AbstractSchemaManager&lt;T&gt;</code>
</InvalidReturnType>
<MoreSpecificImplementedParamType occurrences="1">
<code>$params</code>
<UnrecognizedStatement>
<code><![CDATA[interface MiddlewareInterface extends DoctrineMiddlewareInterface
{
}]]></code>
</UnrecognizedStatement>
</file>
<file src="src/Tracing/Doctrine/DBAL/TracingDriverForV4.php">
<MoreSpecificImplementedParamType>
<code><![CDATA[$params]]></code>
</MoreSpecificImplementedParamType>
<TooManyArguments>
<code><![CDATA[new StaticServerVersionProvider($connection->getServerVersion())]]></code>
<code><![CDATA[parent::__construct($decoratedDriver)]]></code>
</TooManyArguments>
<UndefinedClass>
<code><![CDATA[$this->getDatabasePlatform($versionProvider)]]></code>
</UndefinedClass>
</file>
<file src="src/Tracing/HttpClient/TraceableResponseForV5.php">
<UndefinedInterfaceMethod occurrences="1">
<code>toStream</code>
<UndefinedInterfaceMethod>
<code><![CDATA[toStream]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="src/Tracing/HttpClient/TraceableResponseForV6.php">
<UndefinedInterfaceMethod occurrences="1">
<code>toStream</code>
<UndefinedInterfaceMethod>
<code><![CDATA[toStream]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="src/aliases.php">
<MissingDependency occurrences="1">
<code>TracingDriverForV2</code>
<MissingDependency>
<code><![CDATA[TracingDriverForV2]]></code>
</MissingDependency>
<UndefinedClass occurrences="6">
<code>FilterControllerEvent</code>
<code>FilterResponseEvent</code>
<code>GetResponseEvent</code>
<code>GetResponseEvent</code>
<code>GetResponseForExceptionEvent</code>
<code>PostResponseEvent</code>
</UndefinedClass>
</file>
<file src="src/DependencyInjection/Compiler/CacheTracingPass.php">
<UndefinedDocblockClass occurrences="1">
<code>$container-&gt;getParameter('sentry.tracing.cache.enabled')</code>
</UndefinedDocblockClass>
</file>
<file src="src/DependencyInjection/Compiler/HttpClientTracingPass.php">
<UndefinedDocblockClass occurrences="2">
<code>$container-&gt;getParameter('sentry.tracing.enabled')</code>
<code>$container-&gt;getParameter('sentry.tracing.http_client.enabled')</code>
</UndefinedDocblockClass>
</file>
<file src="src/DependencyInjection/Compiler/DbalTracingPass.php">
<UndefinedDocblockClass occurrences="4">
<code>$container-&gt;getParameter('sentry.tracing.enabled')</code>
<code>$container-&gt;getParameter('sentry.tracing.dbal.enabled')</code>
<code>$container-&gt;getParameter('sentry.tracing.dbal.connections')</code>
<code>$container-&gt;getParameter('doctrine.connections')</code>
</UndefinedDocblockClass>
</file>
</files>
6 changes: 6 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
<projectFiles>
<directory name="src" />
<ignoreFiles>
<file name="src/Tracing/Doctrine/DBAL/TracingDriverConnectionFactoryForV2V3.php" />
<file name="src/Tracing/Doctrine/DBAL/TracingServerInfoAwareDriverConnection.php" />
<file name="src/Tracing/Doctrine/DBAL/TracingDriverConnectionForV2V3.php" />
<file name="src/Tracing/Doctrine/DBAL/TracingDriverForV2.php" />
<file name="src/Tracing/Doctrine/DBAL/TracingDriverForV3.php" />
<file name="src/Tracing/Doctrine/DBAL/TracingStatementForV2.php" />
<file name="src/Tracing/Doctrine/DBAL/TracingStatementForV3.php" />
<file name="src/Tracing/HttpClient/TraceableHttpClientForV4.php" />
<file name="src/Tracing/HttpClient/TraceableHttpClientForV5.php" />
<directory name="vendor" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @internal
*/
final class TracingDriverConnectionFactory implements TracingDriverConnectionFactoryInterface
final class TracingDriverConnectionFactoryForV2V3 implements TracingDriverConnectionFactoryInterface
{
/**
* @var HubInterface The current hub
Expand Down
Loading