diff --git a/composer.json b/composer.json index 10f57235ca6..fe847bef856 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "ext-ctype": "*", "doctrine/collections": "^2.0", "doctrine/common": "^3.3", - "doctrine/dbal": "^3.4", + "doctrine/dbal": "^3.5", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2", "doctrine/inflector": "^1.4 || ^2.0", diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index b4b8bb20ca4..747654ce609 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -340,8 +340,7 @@ public function getSchemaFromMetadata(array $classes): Schema $uniqIndex = new Index($indexName, $this->getIndexColumns($class, $indexData), true, false, [], $indexData['options'] ?? []); foreach ($table->getIndexes() as $tableIndexName => $tableIndex) { - $method = method_exists($tableIndex, 'isFulfilledBy') ? 'isFulfilledBy' : 'isFullfilledBy'; - if ($tableIndex->$method($uniqIndex)) { + if ($tableIndex->isFulfilledBy($uniqIndex)) { $table->dropIndex($tableIndexName); break; } @@ -502,9 +501,8 @@ private function gatherColumn( } if ($table->hasColumn($columnName)) { - $method = method_exists($table, 'modifyColumn') ? 'modifyColumn' : 'changeColumn'; // required in some inheritance scenarios - $table->$method($columnName, $options); + $table->modifyColumn($columnName, $options); } else { $table->addColumn($columnName, $columnType, $options); } @@ -838,12 +836,8 @@ public function dropDatabase(): void */ public function getDropDatabaseSQL(): array { - $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? - 'introspectSchema' : - 'createSchema'; - return $this->schemaManager - ->$method() + ->introspectSchema() ->toDropSql($this->platform); } @@ -858,7 +852,7 @@ public function getDropSchemaSQL(array $classes): array { $schema = $this->getSchemaFromMetadata($classes); - $deployedSchema = $this->introspectSchema(); + $deployedSchema = $this->schemaManager->introspectSchema(); foreach ($schema->getTables() as $table) { if (! $deployedSchema->hasTable($table->getName())) { @@ -949,10 +943,6 @@ public function getUpdateSchemaSql(array $classes, bool $saveMode = false): arra return $schemaDiff->toSaveSql($this->platform); } - if (! method_exists(AbstractPlatform::class, 'getAlterSchemaSQL')) { - return $schemaDiff->toSql($this->platform); - } - return $this->platform->getAlterSchemaSQL($schemaDiff); } @@ -967,12 +957,8 @@ private function createSchemaForComparison(Schema $toSchema): Schema $config = $connection->getConfiguration(); $previousFilter = $config->getSchemaAssetsFilter(); - $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? - 'introspectSchema' : - 'createSchema'; - if ($previousFilter === null) { - return $this->introspectSchema(); + return $this->schemaManager->introspectSchema(); } // whitelist assets we already know about in $toSchema, use the existing filter otherwise @@ -983,19 +969,10 @@ private function createSchemaForComparison(Schema $toSchema): Schema }); try { - return $this->introspectSchema(); + return $this->schemaManager->introspectSchema(); } finally { // restore schema assets filter $config->setSchemaAssetsFilter($previousFilter); } } - - private function introspectSchema(): Schema - { - $method = method_exists($this->schemaManager, 'introspectSchema') - ? 'introspectSchema' - : 'createSchema'; - - return $this->schemaManager->$method(); - } } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index b8b73a1c739..52c7f95beed 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -132,11 +132,6 @@ tests/Doctrine/Tests/Models/DDC1872/DDC1872ExampleTrait.php - - - tests/* - - */tests/* diff --git a/phpstan-dbal4.neon b/phpstan-dbal4.neon index 23b7c9c432a..c8a65adb258 100644 --- a/phpstan-dbal4.neon +++ b/phpstan-dbal4.neon @@ -28,7 +28,3 @@ parameters: message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Schema\\\\SchemaDiff\\:\\:toSaveSql\\(\\)\\.$#" count: 1 path: lib/Doctrine/ORM/Tools/SchemaTool.php - - - message: "#^Call to an undefined method Doctrine\\\\DBAL\\\\Schema\\\\SchemaDiff\\:\\:toSql\\(\\)\\.$#" - count: 1 - path: lib/Doctrine/ORM/Tools/SchemaTool.php diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 9ef47050196..c81e4cea163 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -173,9 +173,8 @@ - + $className - $connection $entity diff --git a/psalm.xml b/psalm.xml index d3248503b2d..e75bc279f6e 100644 --- a/psalm.xml +++ b/psalm.xml @@ -30,10 +30,9 @@ - + - @@ -49,18 +48,6 @@ - - - - - - - - - - - - @@ -79,14 +66,6 @@ - - - - - - - - @@ -133,14 +112,6 @@ - - - - - - - - diff --git a/tests/Doctrine/Tests/DbalTypes/CustomIdObjectType.php b/tests/Doctrine/Tests/DbalTypes/CustomIdObjectType.php index 2094f3e3367..83fd76499ab 100644 --- a/tests/Doctrine/Tests/DbalTypes/CustomIdObjectType.php +++ b/tests/Doctrine/Tests/DbalTypes/CustomIdObjectType.php @@ -7,8 +7,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Type; -use function method_exists; - class CustomIdObjectType extends Type { public const NAME = 'CustomIdObject'; @@ -34,11 +32,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): CustomIdO */ public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { - if (method_exists($platform, 'getStringTypeDeclarationSQL')) { - return $platform->getStringTypeDeclarationSQL($column); - } - - return $platform->getVarcharTypeDeclarationSQL($column); + return $platform->getStringTypeDeclarationSQL($column); } public function getName(): string diff --git a/tests/Doctrine/Tests/DbalTypes/Rot13Type.php b/tests/Doctrine/Tests/DbalTypes/Rot13Type.php index 61a5477b622..d5eb65e017f 100644 --- a/tests/Doctrine/Tests/DbalTypes/Rot13Type.php +++ b/tests/Doctrine/Tests/DbalTypes/Rot13Type.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Type; -use function method_exists; use function str_rot13; /** @@ -48,21 +47,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): string|nu */ public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { - if (method_exists($platform, 'getStringTypeDeclarationSQL')) { - return $platform->getStringTypeDeclarationSQL($column); - } - - return $platform->getVarcharTypeDeclarationSQL($column); - } - - /** - * {@inheritdoc} - * - * @return int|null - */ - public function getDefaultLength(AbstractPlatform $platform) - { - return $platform->getVarcharDefaultLength(); + return $platform->getStringTypeDeclarationSQL($column); } public function getName(): string diff --git a/tests/Doctrine/Tests/ORM/ConfigurationTest.php b/tests/Doctrine/Tests/ORM/ConfigurationTest.php index fcc4436de02..244e20e2bdd 100644 --- a/tests/Doctrine/Tests/ORM/ConfigurationTest.php +++ b/tests/Doctrine/Tests/ORM/ConfigurationTest.php @@ -4,9 +4,6 @@ namespace Doctrine\Tests\ORM; -use Doctrine\Common\Cache\ArrayCache; -use Doctrine\Common\Cache\Cache; -use Doctrine\Common\Cache\Psr6\CacheAdapter; use Doctrine\Deprecations\PHPUnit\VerifyDeprecations; use Doctrine\ORM\Cache\CacheConfiguration; use Doctrine\ORM\Configuration; @@ -17,7 +14,6 @@ use Doctrine\ORM\Mapping\NamingStrategy; use Doctrine\ORM\Mapping\QuoteStrategy; use Doctrine\ORM\Proxy\ProxyFactory; -use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\Persistence\Mapping\Driver\MappingDriver; use Doctrine\Tests\DoctrineTestCase; use Doctrine\Tests\Models\DDC753\DDC753CustomRepository; diff --git a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php index e9895675700..dc9ffc4e4de 100644 --- a/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/DetachedEntityTest.php @@ -5,10 +5,6 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; -use Doctrine\ORM\OptimisticLockException; -use Doctrine\Persistence\Proxy; -use Doctrine\Tests\Models\CMS\CmsAddress; -use Doctrine\Tests\Models\CMS\CmsArticle; use Doctrine\Tests\Models\CMS\CmsPhonenumber; use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\OrmFunctionalTestCase; diff --git a/tests/Doctrine/Tests/ORM/Functional/GH5988Test.php b/tests/Doctrine/Tests/ORM/Functional/GH5988Test.php index e0149e85105..28fa4542997 100644 --- a/tests/Doctrine/Tests/ORM/Functional/GH5988Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/GH5988Test.php @@ -16,7 +16,6 @@ use Doctrine\Tests\DbalTypes\CustomIdObject; use Doctrine\Tests\OrmFunctionalTestCase; -use function method_exists; use function str_replace; /** @@ -79,11 +78,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): CustomIdO */ public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { - if (method_exists($platform, 'getStringTypeDeclarationSQL')) { - return $platform->getStringTypeDeclarationSQL($column); - } - - return $platform->getVarcharTypeDeclarationSQL($column); + return $platform->getStringTypeDeclarationSQL($column); } public function getName(): string diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php index 4e23a596492..eaba7fa8ce0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/CompanySchemaTest.php @@ -4,12 +4,9 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool; -use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\Schema; use Doctrine\Tests\OrmFunctionalTestCase; -use function method_exists; - /** * Functional tests for the Class Table Inheritance mapping strategy. */ @@ -24,10 +21,7 @@ protected function setUp(): void /** @group DDC-966 */ public function testGeneratedSchema(): Schema { - $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? - 'introspectSchema' : - 'createSchema'; - $schema = $this->createSchemaManager()->$method(); + $schema = $this->createSchemaManager()->introspectSchema(); self::assertTrue($schema->hasTable('company_contracts')); diff --git a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php index 60ef9714dc9..38914583487 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/SchemaTool/DDC214Test.php @@ -4,16 +4,12 @@ namespace Doctrine\Tests\ORM\Functional\SchemaTool; -use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\SQLitePlatform; -use Doctrine\DBAL\Schema\AbstractSchemaManager; -use Doctrine\DBAL\Schema\Comparator; use Doctrine\Tests\Models; use Doctrine\Tests\OrmFunctionalTestCase; use function array_filter; use function implode; -use function method_exists; use function str_contains; use const PHP_EOL; @@ -69,17 +65,12 @@ public function assertCreatedSchemaNeedsNoUpdates(string ...$classes): void $sm = $this->createSchemaManager(); - $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? - 'introspectSchema' : - 'createSchema'; - $fromSchema = $sm->$method(); + $fromSchema = $sm->introspectSchema(); $toSchema = $this->getSchemaForModels(...$classes); $comparator = $sm->createComparator(); $schemaDiff = $comparator->compareSchemas($fromSchema, $toSchema); - $sql = method_exists(AbstractPlatform::class, 'getAlterSchemaSQL') ? - $this->_em->getConnection()->getDatabasePlatform()->getAlterSchemaSQL($schemaDiff) : - $schemaDiff->toSql($this->_em->getConnection()->getDatabasePlatform()); + $sql = $this->_em->getConnection()->getDatabasePlatform()->getAlterSchemaSQL($schemaDiff); $sql = array_filter($sql, static fn ($sql) => ! str_contains($sql, 'DROP')); diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php index ddaf3e8524a..0bf50d57f16 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2012Test.php @@ -19,7 +19,6 @@ use function explode; use function implode; use function is_array; -use function method_exists; use function sprintf; use function strtolower; @@ -129,11 +128,7 @@ class DDC2012TsVectorType extends Type */ public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { - if (method_exists($platform, 'getStringTypeDeclarationSQL')) { - return $platform->getStringTypeDeclarationSQL($column); - } - - return $platform->getVarcharTypeDeclarationSQL($column); + return $platform->getStringTypeDeclarationSQL($column); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php index a287d09faa1..e7986d6e87e 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2224Test.php @@ -14,7 +14,6 @@ use Doctrine\Tests\OrmFunctionalTestCase; use Symfony\Component\Cache\Adapter\ArrayAdapter; -use function method_exists; use function sprintf; /** @group DDC-2224 */ @@ -52,11 +51,7 @@ class DDC2224Type extends Type */ public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { - if (method_exists($platform, 'getStringTypeDeclarationSQL')) { - return $platform->getStringTypeDeclarationSQL($column); - } - - return $platform->getVarcharTypeDeclarationSQL($column); + return $platform->getStringTypeDeclarationSQL($column); } public function getName(): string diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php index cb09b8c1038..1721bb7f329 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH5804Test.php @@ -16,8 +16,6 @@ use Doctrine\ORM\Mapping\Version; use Doctrine\Tests\OrmFunctionalTestCase; -use function method_exists; - /** @group GH-5804 */ final class GH5804Test extends OrmFunctionalTestCase { @@ -69,11 +67,7 @@ public function getName(): string */ public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { - if (method_exists($platform, 'getStringTypeDeclarationSQL')) { - return $platform->getStringTypeDeclarationSQL($column); - } - - return $platform->getVarcharTypeDeclarationSQL($column); + return $platform->getStringTypeDeclarationSQL($column); } /** diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6823Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6823Test.php index 8ab0284a02d..0147cfe927b 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6823Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH6823Test.php @@ -16,8 +16,6 @@ use Doctrine\ORM\Mapping\Table; use Doctrine\Tests\OrmFunctionalTestCase; -use function method_exists; - class GH6823Test extends OrmFunctionalTestCase { public function testCharsetCollationWhenCreatingForeignRelations(): void @@ -33,28 +31,27 @@ public function testCharsetCollationWhenCreatingForeignRelations(): void ); $schemaManager = $this->createSchemaManager(); - $method = method_exists($schemaManager, 'introspectTable') ? 'introspectTable' : 'listTableDetails'; /* gh6823_user.group_id should use charset ascii and collation * ascii_general_ci, because that is what gh6823_group.id falls back to */ - $userGroupIdOptions = $schemaManager->$method('gh6823_user')->getColumn('group_id')->toArray(); + $userGroupIdOptions = $schemaManager->introspectTable('gh6823_user')->getColumn('group_id')->toArray(); self::assertSame('ascii', $userGroupIdOptions['charset']); self::assertSame('ascii_general_ci', $userGroupIdOptions['collation']); /* gh6823_user.status_id should use charset latin1 and collation * latin1_bin, because that is what gh6823_status.id uses */ - $userStatusIdOptions = $schemaManager->$method('gh6823_user')->getColumn('status_id')->toArray(); + $userStatusIdOptions = $schemaManager->introspectTable('gh6823_user')->getColumn('status_id')->toArray(); self::assertSame('latin1', $userStatusIdOptions['charset']); self::assertSame('latin1_bin', $userStatusIdOptions['collation']); /* gh6823_user_tags.user_id should use charset utf8mb4 and collation * utf8mb4_bin, because that is what gh6823_user.id falls back to */ - $userTagsUserIdOptions = $schemaManager->$method('gh6823_user_tags')->getColumn('user_id')->toArray(); + $userTagsUserIdOptions = $schemaManager->introspectTable('gh6823_user_tags')->getColumn('user_id')->toArray(); self::assertSame('utf8mb4', $userTagsUserIdOptions['charset']); self::assertSame('utf8mb4_bin', $userTagsUserIdOptions['collation']); /* gh6823_user_tags.tag_id should use charset latin1 and collation * latin1_bin, because that is what gh6823_tag.id falls back to */ - $userTagsTagIdOption = $schemaManager->$method('gh6823_user_tags')->getColumn('tag_id')->toArray(); + $userTagsTagIdOption = $schemaManager->introspectTable('gh6823_user_tags')->getColumn('tag_id')->toArray(); self::assertSame('latin1', $userTagsTagIdOption['charset']); self::assertSame('latin1_bin', $userTagsTagIdOption['collation']); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php index 914c0113a4e..fc24aaefb9c 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8061Test.php @@ -12,7 +12,6 @@ use Doctrine\ORM\Mapping\Id; use Doctrine\Tests\OrmTestCase; -use function method_exists; use function sprintf; /** @group GH8061 */ @@ -55,11 +54,7 @@ final class GH8061Type extends Type { public function getSQLDeclaration(array $column, AbstractPlatform $platform): string { - if (method_exists($platform, 'getStringTypeDeclarationSQL')) { - return $platform->getStringTypeDeclarationSQL($column); - } - - return $platform->getVarcharTypeDeclarationSQL($column); + return $platform->getStringTypeDeclarationSQL($column); } public function getName(): string diff --git a/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php b/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php index 2d5195bf44e..a8dbafe750c 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php @@ -8,7 +8,6 @@ use Doctrine\Tests\Models\Company\CompanyContractListener; use Doctrine\Tests\Models\Company\CompanyFlexUltraContractListener; use Doctrine\Tests\OrmTestCase; -use InvalidArgumentException; /** @group DDC-1955 */ class EntityListenerResolverTest extends OrmTestCase diff --git a/tests/Doctrine/Tests/ORM/Mapping/MappingDriverTestCase.php b/tests/Doctrine/Tests/ORM/Mapping/MappingDriverTestCase.php index 74f658dccd3..4f3fd07ee8f 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/MappingDriverTestCase.php +++ b/tests/Doctrine/Tests/ORM/Mapping/MappingDriverTestCase.php @@ -41,14 +41,12 @@ use Doctrine\Tests\Models\CMS\CmsAddress; use Doctrine\Tests\Models\CMS\CmsAddressListener; use Doctrine\Tests\Models\CMS\CmsEmail; -use Doctrine\Tests\Models\CMS\CmsUser; use Doctrine\Tests\Models\Company\CompanyContract; use Doctrine\Tests\Models\Company\CompanyContractListener; use Doctrine\Tests\Models\Company\CompanyFixContract; use Doctrine\Tests\Models\Company\CompanyFlexContract; use Doctrine\Tests\Models\Company\CompanyFlexUltraContract; use Doctrine\Tests\Models\Company\CompanyFlexUltraContractListener; -use Doctrine\Tests\Models\Company\CompanyPerson; use Doctrine\Tests\Models\DDC1476\DDC1476EntityWithDefaultFieldType; use Doctrine\Tests\Models\DDC2825\ExplicitSchemaAndTable; use Doctrine\Tests\Models\DDC2825\SchemaAndTableInTableName; diff --git a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php index 340d366ef84..989dc9aded8 100644 --- a/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php +++ b/tests/Doctrine/Tests/ORM/UnitOfWorkTest.php @@ -36,7 +36,6 @@ use PHPUnit\Framework\MockObject\MockObject; use stdClass; -use function method_exists; use function random_int; use function uniqid; @@ -72,11 +71,6 @@ protected function setUp(): void $driverStatement = $this->createMock(Statement::class); - if (method_exists($driverStatement, 'rowCount')) { - $driverStatement->method('rowCount') - ->willReturn(0); - } - $driverConnection = $this->createMock(Driver\Connection::class); $driverConnection->method('prepare') ->willReturn($driverStatement); diff --git a/tests/Doctrine/Tests/TestUtil.php b/tests/Doctrine/Tests/TestUtil.php index abb1249d1b0..a4275288fd1 100644 --- a/tests/Doctrine/Tests/TestUtil.php +++ b/tests/Doctrine/Tests/TestUtil.php @@ -10,14 +10,12 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException; use Doctrine\DBAL\Platforms\SQLitePlatform; -use Doctrine\DBAL\Schema\AbstractSchemaManager; use UnexpectedValueException; use function assert; use function explode; use function fwrite; use function get_debug_type; -use function method_exists; use function sprintf; use function str_starts_with; use function strlen; @@ -92,10 +90,7 @@ private static function initializeDatabase(): void $platform = $privConn->getDatabasePlatform(); if ($platform instanceof SQLitePlatform) { - $method = method_exists(AbstractSchemaManager::class, 'introspectSchema') ? - 'introspectSchema' : - 'createSchema'; - $schema = $testConn->createSchemaManager()->$method(); + $schema = $testConn->createSchemaManager()->introspectSchema(); $stmts = $schema->toDropSql($testConn->getDatabasePlatform()); foreach ($stmts as $stmt) {