Skip to content

Commit

Permalink
Merge pull request #5521 from derrabus/improvement/rename-sqlite-plat…
Browse files Browse the repository at this point in the history
…form
  • Loading branch information
derrabus committed Jul 19, 2022
2 parents 77f0aff + 198d97c commit 9045f6d
Show file tree
Hide file tree
Showing 26 changed files with 69 additions and 66 deletions.
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ awareness about deprecated code.

# Upgrade to 4.0

## BC BREAK: renamed SQLite platform classes

1. `SqlitePlatform` => `SQLitePlatform`
2. `SqliteSchemaManager` => `SQLiteSchemaManager`

## BC BREAK: removed `SqlitePlatform` methods.

1. `getTinyIntTypeDeclarationSQL()`,
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ IBM DB2
SQLite
^^^^^^

- ``SqlitePlatform`` for all versions.
- ``SQLitePlatform`` for all versions.

It is highly encouraged to use the platform class that matches your
database vendor and version best. Otherwise it is not guaranteed
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<!-- This could be considered a bug in the sniff or the shortcoming of the Platform API design
see https://github.com/squizlabs/PHP_CodeSniffer/issues/3035 -->
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod.Found">
<exclude-pattern>src/Platforms/SqlitePlatform.php</exclude-pattern>
<exclude-pattern>src/Platforms/SQLitePlatform.php</exclude-pattern>
<exclude-pattern>src/Platforms/*/Comparator.php</exclude-pattern>
</rule>
</ruleset>
4 changes: 2 additions & 2 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<file name="src/Platforms/AbstractMySQLPlatform.php"/>
<file name="src/Platforms/AbstractPlatform.php"/>
<file name="src/Platforms/SQLServerPlatform.php"/>
<file name="src/Platforms/SqlitePlatform.php"/>
<file name="src/Platforms/SQLitePlatform.php"/>
<file name="src/Schema/Column.php"/>
<!-- See https://github.com/vimeo/psalm/issues/5472 -->
<file name="src/Portability/Converter.php"/>
Expand Down Expand Up @@ -123,7 +123,7 @@
<!--
This is a valid issue and requires some refactoring.
-->
<file name="src/Schema/SqliteSchemaManager.php"/>
<file name="src/Schema/SQLiteSchemaManager.php"/>
</errorLevel>
</PossiblyNullArgument>
<PossiblyUndefinedArrayOffset>
Expand Down
6 changes: 3 additions & 3 deletions src/Driver/AbstractSQLiteDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\API\SQLite\ExceptionConverter;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\ServerVersionProvider;

/**
* Abstract base implementation of the {@see Driver} interface for SQLite based drivers.
*/
abstract class AbstractSQLiteDriver implements Driver
{
public function getDatabasePlatform(ServerVersionProvider $versionProvider): SqlitePlatform
public function getDatabasePlatform(ServerVersionProvider $versionProvider): SQLitePlatform
{
return new SqlitePlatform();
return new SQLitePlatform();
}

public function getExceptionConverter(): ExceptionConverter
Expand Down
4 changes: 2 additions & 2 deletions src/Platforms/SQLite/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\DBAL\Platforms\SQLite;

use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Schema\Comparator as BaseComparator;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
Expand All @@ -21,7 +21,7 @@ class Comparator extends BaseComparator
/**
* @internal The comparator can be only instantiated by a schema manager.
*/
public function __construct(SqlitePlatform $platform)
public function __construct(SQLitePlatform $platform)
{
parent::__construct($platform);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\SqliteSchemaManager;
use Doctrine\DBAL\Schema\SQLiteSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
Expand All @@ -34,12 +34,10 @@
use function trim;

/**
* The SqlitePlatform class describes the specifics and dialects of the SQLite
* The SQLitePlatform class describes the specifics and dialects of the SQLite
* database platform.
*
* @todo Rename: SQLitePlatform
*/
class SqlitePlatform extends AbstractPlatform
class SQLitePlatform extends AbstractPlatform
{
/**
* @throws NotSupported
Expand Down Expand Up @@ -1044,8 +1042,8 @@ private function getPrimaryIndexInAlteredTable(TableDiff $diff, Table $fromTable
return $primaryIndex;
}

public function createSchemaManager(Connection $connection): SqliteSchemaManager
public function createSchemaManager(Connection $connection): SQLiteSchemaManager
{
return new SqliteSchemaManager($connection, $this);
return new SQLiteSchemaManager($connection, $this);
}
}
4 changes: 2 additions & 2 deletions src/Portability/OptimizeFlags.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;

final class OptimizeFlags
Expand All @@ -23,7 +23,7 @@ final class OptimizeFlags
DB2Platform::class => 0,
OraclePlatform::class => Connection::PORTABILITY_EMPTY_TO_NULL,
PostgreSQLPlatform::class => 0,
SqlitePlatform::class => 0,
SQLitePlatform::class => 0,
SQLServerPlatform::class => 0,
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SQLite;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Types\StringType;
use Doctrine\DBAL\Types\TextType;
Expand Down Expand Up @@ -34,11 +34,11 @@
use const CASE_LOWER;

/**
* Sqlite SchemaManager.
* SQLite SchemaManager.
*
* @extends AbstractSchemaManager<SqlitePlatform>
* @extends AbstractSchemaManager<SQLitePlatform>
*/
class SqliteSchemaManager extends AbstractSchemaManager
class SQLiteSchemaManager extends AbstractSchemaManager
{
/**
* {@inheritDoc}
Expand Down
10 changes: 5 additions & 5 deletions tests/Driver/AbstractSQLiteDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
use Doctrine\DBAL\Driver\API\ExceptionConverter;
use Doctrine\DBAL\Driver\API\SQLite;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SqliteSchemaManager;
use Doctrine\DBAL\Schema\SQLiteSchemaManager;

/**
* @extends AbstractDriverTest<SqlitePlatform>
* @extends AbstractDriverTest<SQLitePlatform>
*/
class AbstractSQLiteDriverTest extends AbstractDriverTest
{
Expand All @@ -26,12 +26,12 @@ protected function createDriver(): Driver

protected function createPlatform(): AbstractPlatform
{
return new SqlitePlatform();
return new SQLitePlatform();
}

protected function createSchemaManager(Connection $connection): AbstractSchemaManager
{
return new SqliteSchemaManager(
return new SQLiteSchemaManager(
$connection,
$this->createPlatform()
);
Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
Expand Down Expand Up @@ -82,7 +82,7 @@ public function testTransactionNestingLevelIsResetOnReconnect(): void
self::markTestSkipped('This test requires the platform to support savepoints.');
}

if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
if ($this->connection->getDatabasePlatform() instanceof SQLitePlatform) {
$params = $this->connection->getParams();
$params['memory'] = false;
$params['path'] = '/tmp/test_nesting.sqlite';
Expand Down Expand Up @@ -320,7 +320,7 @@ public function testPersistentConnection(): void
$platform = $this->connection->getDatabasePlatform();

if (
$platform instanceof SqlitePlatform
$platform instanceof SQLitePlatform
|| $platform instanceof SQLServerPlatform
) {
self::markTestSkipped('The platform does not support persistent connections');
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/DataAccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\TrimMode;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Statement;
Expand Down Expand Up @@ -712,7 +712,7 @@ public function testSqliteDateArithmeticWithDynamicInterval(): void
{
$platform = $this->connection->getDatabasePlatform();

if (! $platform instanceof SqlitePlatform) {
if (! $platform instanceof SQLitePlatform) {
self::markTestSkipped('test is for sqlite only');
}

Expand Down
6 changes: 3 additions & 3 deletions tests/Functional/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
Expand Down Expand Up @@ -128,7 +128,7 @@ public function testSyntaxErrorException(): void

public function testConnectionExceptionSqLite(): void
{
if (! ($this->connection->getDatabasePlatform() instanceof SqlitePlatform)) {
if (! ($this->connection->getDatabasePlatform() instanceof SQLitePlatform)) {
self::markTestSkipped('Only fails this way on sqlite');
}

Expand Down Expand Up @@ -205,7 +205,7 @@ private function testConnectionException(array $params): void
{
$platform = $this->connection->getDatabasePlatform();

if ($platform instanceof SqlitePlatform) {
if ($platform instanceof SQLitePlatform) {
self::markTestSkipped('The SQLite driver does not use a network connection');
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/LockMode/NoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
Expand Down Expand Up @@ -48,7 +48,7 @@ public function setUp(): void
return;
}

if ($this->connection2->getDatabasePlatform() instanceof SqlitePlatform) {
if ($this->connection2->getDatabasePlatform() instanceof SQLitePlatform) {
self::markTestSkipped('This test cannot run on SQLite using an in-memory database');
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Platform/ColumnTest/SQLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\DBAL\Tests\Functional\Platform\ColumnTest;

use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Tests\Functional\Platform\ColumnTest;

final class SQLite extends ColumnTest
Expand All @@ -13,6 +13,6 @@ protected function setUp(): void
{
parent::setUp();

$this->requirePlatform(SqlitePlatform::class);
$this->requirePlatform(SQLitePlatform::class);
}
}
4 changes: 2 additions & 2 deletions tests/Functional/Schema/SQLite/ComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\DBAL\Tests\Functional\Schema\SQLite;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Table;
Expand All @@ -25,7 +25,7 @@ protected function setUp(): void
{
$this->platform = $this->connection->getDatabasePlatform();

if (! $this->platform instanceof SqlitePlatform) {
if (! $this->platform instanceof SQLitePlatform) {
self::markTestSkipped();
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\AbstractAsset;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
Expand Down Expand Up @@ -446,7 +446,7 @@ public function testDropAndCreateIndex(): void

public function testDropAndCreateUniqueConstraint(): void
{
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
if ($this->connection->getDatabasePlatform() instanceof SQLitePlatform) {
self::markTestSkipped('SQLite does not support adding constraints to a table');
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Schema/SqliteSchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\BlobType;
Expand All @@ -17,7 +17,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
protected function supportsPlatform(AbstractPlatform $platform): bool
{
return $platform instanceof SqlitePlatform;
return $platform instanceof SQLitePlatform;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Ticket/DBAL752Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Doctrine\DBAL\Tests\Functional\Ticket;

use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Tests\FunctionalTestCase;
use Doctrine\DBAL\Types\BigIntType;
use Doctrine\DBAL\Types\IntegerType;
Expand All @@ -14,7 +14,7 @@ class DBAL752Test extends FunctionalTestCase
{
protected function setUp(): void
{
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
if ($this->connection->getDatabasePlatform() instanceof SQLitePlatform) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Platforms/SQLite/ComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
namespace Doctrine\DBAL\Tests\Platforms\SQLite;

use Doctrine\DBAL\Platforms\SQLite\Comparator;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Tests\Schema\ComparatorTest as BaseComparatorTest;

class ComparatorTest extends BaseComparatorTest
{
protected function setUp(): void
{
$this->comparator = new Comparator(new SqlitePlatform());
$this->comparator = new Comparator(new SQLitePlatform());
}

public function testCompareChangedBinaryColumn(): void
Expand Down

0 comments on commit 9045f6d

Please sign in to comment.