diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4ca224fb..16c124ff 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -30,8 +30,6 @@ jobs: - 6.* dependencies: - highest - doctrine-dbal: - - highest exclude: - php: '7.2' symfony-version: 6.* @@ -43,18 +41,12 @@ jobs: - php: '7.2' symfony-version: 4.4.* dependencies: lowest - doctrine-dbal: '^2.13' - php: '7.2' symfony-version: 5.* dependencies: lowest - doctrine-dbal: '^2.13' - php: '8.0' symfony-version: 6.* dependencies: lowest - doctrine-dbal: '^2.13' - - php: '8.0' - symfony-version: 6.* - doctrine-dbal: '<3.2' steps: - name: Checkout @@ -76,10 +68,6 @@ jobs: run: composer require --dev phpunit/phpunit ^9.3.9 --no-update if: matrix.php == '8.0' && matrix.dependencies == 'lowest' - - name: Update Doctrine DBAL - run: composer require --dev doctrine/dbal "${{ matrix.doctrine-dbal }}" --no-update - if: matrix.doctrine-dbal != 'highest' - - name: Install dependencies uses: ramsey/composer-install@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 17ec04ba..40e4c688 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.9.2 + +The Sentry SDK team is happy to announce the immediate availability of Sentry Symfony SDK v4.9.2. + +### Bug Fixes + +- We decided to revert two previous PRs that aimed to remove deprecation warnings during test runs [(#736)](https://github.com/getsentry/sentry-symfony/pull/736) + + - Revert: Add a new Doctrine DBAL tracing driver that does not implement the deprecated `VersionAwarePlatformDriver` [(#723)](https://github.com/getsentry/sentry-symfony/pull/723) + - Revert: Fix a regression in `TracingDriverForV32` by adding `VersionAwarePlatformDriver::createDatabasePlatformForVersion` [(#731)](https://github.com/getsentry/sentry-symfony/pull/731) + +We are sorry for the inconvenience caused by these changes. + ## 4.9.1 The Sentry SDK team is happy to announce the immediate availability of Sentry Symfony SDK v4.9.1. diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 702f2f01..32016223 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -50,17 +50,6 @@ $params - - - $this->decoratedDriver->getSchemaManager($conn, $platform) - - - AbstractSchemaManager<T> - - - $params - - toStream diff --git a/src/Tracing/Doctrine/DBAL/TracingDriverForV32.php b/src/Tracing/Doctrine/DBAL/TracingDriverForV32.php deleted file mode 100644 index e7e5516d..00000000 --- a/src/Tracing/Doctrine/DBAL/TracingDriverForV32.php +++ /dev/null @@ -1,105 +0,0 @@ -= 3.2. - * - * @internal - * - * @phpstan-import-type Params from \Doctrine\DBAL\DriverManager as ConnectionParams - */ -final class TracingDriverForV32 implements Driver -{ - /** - * @var TracingDriverConnectionFactoryInterface The connection factory - */ - private $connectionFactory; - - /** - * @var Driver The instance of the decorated driver - */ - private $decoratedDriver; - - /** - * Constructor. - * - * @param TracingDriverConnectionFactoryInterface $connectionFactory The connection factory - * @param Driver $decoratedDriver The instance of the driver to decorate - */ - public function __construct(TracingDriverConnectionFactoryInterface $connectionFactory, Driver $decoratedDriver) - { - $this->connectionFactory = $connectionFactory; - $this->decoratedDriver = $decoratedDriver; - } - - /** - * {@inheritdoc} - * - * @phpstan-param ConnectionParams $params - */ - public function connect(array $params): TracingDriverConnectionInterface - { - return $this->connectionFactory->create( - $this->decoratedDriver->connect($params), - $this->decoratedDriver->getDatabasePlatform(), - $params - ); - } - - /** - * {@inheritdoc} - */ - public function getDatabasePlatform(): AbstractPlatform - { - return $this->decoratedDriver->getDatabasePlatform(); - } - - /** - * {@inheritdoc} - * - * @phpstan-template T of AbstractPlatform - * - * @phpstan-param T $platform - * - * @phpstan-return AbstractSchemaManager - */ - public function getSchemaManager(Connection $conn, AbstractPlatform $platform): AbstractSchemaManager - { - return $this->decoratedDriver->getSchemaManager($conn, $platform); - } - - /** - * {@inheritdoc} - */ - public function getExceptionConverter(): ExceptionConverter - { - return $this->decoratedDriver->getExceptionConverter(); - } - - /** - * {@inheritdoc} - * - * @phpstan-param string $version - * - * @phpstan-return AbstractPlatform - */ - public function createDatabasePlatformForVersion($version): AbstractPlatform - { - if (method_exists($this->decoratedDriver, 'createDatabasePlatformForVersion')) { - return $this->decoratedDriver->createDatabasePlatformForVersion($version); - } - - return $this->getDatabasePlatform(); - } -} diff --git a/src/aliases.php b/src/aliases.php index 4f2ede6f..839a55c9 100644 --- a/src/aliases.php +++ b/src/aliases.php @@ -4,7 +4,6 @@ namespace Sentry\SentryBundle; -use Doctrine\DBAL\Exception\SchemaDoesNotExist; use Doctrine\DBAL\Result; use Sentry\SentryBundle\Tracing\Cache\TraceableCacheAdapter; use Sentry\SentryBundle\Tracing\Cache\TraceableCacheAdapterForV2; @@ -15,7 +14,6 @@ use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingDriver; use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingDriverForV2; use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingDriverForV3; -use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingDriverForV32; use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingStatement; use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingStatementForV2; use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingStatementForV3; @@ -55,12 +53,7 @@ class_alias(TraceableTagAwareCacheAdapterForV2::class, TraceableTagAwareCacheAda if (!class_exists(TracingStatement::class)) { if (class_exists(Result::class)) { class_alias(TracingStatementForV3::class, TracingStatement::class); - - if (class_exists(SchemaDoesNotExist::class)) { - class_alias(TracingDriverForV32::class, TracingDriver::class); - } else { - class_alias(TracingDriverForV3::class, TracingDriver::class); - } + class_alias(TracingDriverForV3::class, TracingDriver::class); } elseif (interface_exists(Result::class)) { class_alias(TracingStatementForV2::class, TracingStatement::class); class_alias(TracingDriverForV2::class, TracingDriver::class); diff --git a/tests/DoctrineTestCase.php b/tests/DoctrineTestCase.php index 5d581cda..6d4c7626 100644 --- a/tests/DoctrineTestCase.php +++ b/tests/DoctrineTestCase.php @@ -7,7 +7,6 @@ use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver\ResultStatement; -use Doctrine\DBAL\Exception\SchemaDoesNotExist; use PHPUnit\Framework\TestCase; abstract class DoctrineTestCase extends TestCase @@ -29,12 +28,6 @@ protected static function isDoctrineDBALVersion3Installed(): bool && !self::isDoctrineDBALVersion2Installed(); } - protected static function isDoctrineDBALVersion32Installed(): bool - { - return self::isDoctrineDBALInstalled() - && class_exists(SchemaDoesNotExist::class); - } - protected static function isDoctrineBundlePackageInstalled(): bool { return class_exists(DoctrineBundle::class); diff --git a/tests/Tracing/Doctrine/DBAL/TracingDriverForV32Test.php b/tests/Tracing/Doctrine/DBAL/TracingDriverForV32Test.php deleted file mode 100644 index 76a1da24..00000000 --- a/tests/Tracing/Doctrine/DBAL/TracingDriverForV32Test.php +++ /dev/null @@ -1,148 +0,0 @@ -= 3.2.'); - } - } - - protected function setUp(): void - { - $this->connectionFactory = $this->createMock(TracingDriverConnectionFactoryInterface::class); - } - - public function testConnect(): void - { - $params = ['host' => 'localhost']; - $databasePlatform = $this->createMock(AbstractPlatform::class); - $driverConnection = $this->createMock(DriverConnectionInterface::class); - $tracingDriverConnection = $this->createMock(TracingDriverConnectionInterface::class); - $decoratedDriver = $this->createMock(DriverInterface::class); - - $decoratedDriver->expects($this->once()) - ->method('connect') - ->with($params) - ->willReturn($driverConnection); - - $decoratedDriver->expects($this->once()) - ->method('getDatabasePlatform') - ->willReturn($databasePlatform); - - $this->connectionFactory->expects($this->once()) - ->method('create') - ->with($driverConnection, $databasePlatform, $params) - ->willReturn($tracingDriverConnection); - - $driver = new TracingDriverForV32($this->connectionFactory, $decoratedDriver); - - $this->assertSame($tracingDriverConnection, $driver->connect($params)); - } - - public function testGetDatabasePlatform(): void - { - $databasePlatform = $this->createMock(AbstractPlatform::class); - - $decoratedDriver = $this->createMock(DriverInterface::class); - $decoratedDriver->expects($this->once()) - ->method('getDatabasePlatform') - ->willReturn($databasePlatform); - - $driver = new TracingDriverForV32($this->connectionFactory, $decoratedDriver); - - $this->assertSame($databasePlatform, $driver->getDatabasePlatform()); - } - - /** - * @group legacy - */ - public function testGetSchemaManager(): void - { - $connection = $this->createMock(Connection::class); - $databasePlatform = $this->createMock(AbstractPlatform::class); - $schemaManager = $this->createMock(AbstractSchemaManager::class); - - $decoratedDriver = $this->createMock(DriverInterface::class); - $decoratedDriver->expects($this->once()) - ->method('getSchemaManager') - ->with($connection, $databasePlatform) - ->willReturn($schemaManager); - - $driver = new TracingDriverForV32($this->connectionFactory, $decoratedDriver); - - $this->assertSame($schemaManager, $driver->getSchemaManager($connection, $databasePlatform)); - } - - public function testGetExceptionConverter(): void - { - $exceptionConverter = $this->createMock(ExceptionConverter::class); - - $decoratedDriver = $this->createMock(DriverInterface::class); - $decoratedDriver->expects($this->once()) - ->method('getExceptionConverter') - ->willReturn($exceptionConverter); - - $driver = new TracingDriverForV32($this->connectionFactory, $decoratedDriver); - - $this->assertSame($exceptionConverter, $driver->getExceptionConverter()); - } - - public function testCreateDatabasePlatform(): void - { - $databasePlatform = $this->createMock(AbstractPlatform::class); - - $decoratedDriver = $this->createMock(DriverInterface::class); - $decoratedDriver->expects($this->once()) - ->method('getDatabasePlatform') - ->willReturn($databasePlatform); - - $driver = new TracingDriverForV32($this->connectionFactory, $decoratedDriver); - - $this->assertSame($databasePlatform, $driver->createDatabasePlatformForVersion('5.7')); - } - - public function testCreateDatabasePlatformForVersionWhenDriverDefinedCreateDatabasePlatformForVersion(): void - { - $databasePlatform = $this->createMock(AbstractPlatform::class); - - $decoratedDriver = $this->createMock(StubCreateDatabasePlatformForVersionDriver::class); - $decoratedDriver->expects($this->once()) - ->method('createDatabasePlatformForVersion') - ->with('5.7') - ->willReturn($databasePlatform); - - $driver = new TracingDriverForV32($this->connectionFactory, $decoratedDriver); - - $this->assertSame($databasePlatform, $driver->createDatabasePlatformForVersion('5.7')); - } -} - -if (interface_exists(DriverInterface::class)) { - interface StubCreateDatabasePlatformForVersionDriver extends DriverInterface - { - public function createDatabasePlatformForVersion(string $version): AbstractPlatform; - } -} diff --git a/tests/Tracing/Doctrine/DBAL/TracingDriverForV3Test.php b/tests/Tracing/Doctrine/DBAL/TracingDriverForV3Test.php index 68291e55..af3a857b 100644 --- a/tests/Tracing/Doctrine/DBAL/TracingDriverForV3Test.php +++ b/tests/Tracing/Doctrine/DBAL/TracingDriverForV3Test.php @@ -26,8 +26,8 @@ final class TracingDriverForV3Test extends DoctrineTestCase public static function setUpBeforeClass(): void { - if (!self::isDoctrineDBALVersion3Installed() || self::isDoctrineDBALVersion32Installed()) { - self::markTestSkipped('This test requires the version of the "doctrine/dbal" Composer package to be >= 3.0 <= 3.2.'); + if (!self::isDoctrineDBALVersion3Installed()) { + self::markTestSkipped('This test requires the version of the "doctrine/dbal" Composer package to be >= 3.0.'); } } diff --git a/tests/Tracing/Doctrine/DBAL/TracingStatementForV3Test.php b/tests/Tracing/Doctrine/DBAL/TracingStatementForV3Test.php index 653b7d87..566b178a 100644 --- a/tests/Tracing/Doctrine/DBAL/TracingStatementForV3Test.php +++ b/tests/Tracing/Doctrine/DBAL/TracingStatementForV3Test.php @@ -55,9 +55,6 @@ public function testBindValue(): void $this->assertTrue($this->statement->bindValue('foo', 'bar', ParameterType::INTEGER)); } - /** - * @group legacy - */ public function testBindParam(): void { $variable = 'bar';