Skip to content

Commit 403f7a9

Browse files
committed
Remove keywords lists
1 parent 8f4a76f commit 403f7a9

25 files changed

+18
-1949
lines changed

UPGRADE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ awareness about deprecated code.
88

99
# Upgrade to 5.0
1010

11+
## BC BREAK: Removed Reserved Keyword Lists
12+
13+
The following components have been removed:
14+
15+
1. The `KeywordList` class and all its subclasses.
16+
2. The methods `AbstractPlatform::createReservedKeywordsList()` and `::getReservedKeywordsList()`.
17+
3. The `AbstractPlatform::$_keywords` property.
18+
19+
DBAL will consistently quote all identifiers, regardless of whether they are keywords or not. It will also normalize the
20+
ase of unquoted identifiers to match the behavior of the target database platform:
21+
22+
- Oracle and IBM DB2 – upper case.
23+
- PostgreSQL – lower case.
24+
- All other platforms – original case.
25+
26+
To preserve the lower case of identifiers on Oracle and IBM DB2 or the upper case on PostgreSQL, quote the identifiers
27+
explicitly.
28+
1129
## BC BREAK: Removed `AbstractPlatform::quoteIdentifier()` and `Connection::quoteIdentifier()`
1230

1331
The `AbstractPlatform::quoteIdentifier()` and `Connection::quoteIdentifier()` methods have been removed.

psalm.xml.dist

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@
4242
<file name="src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php"/>
4343
</errorLevel>
4444
</ConflictingReferenceConstraint>
45-
<DeprecatedClass>
46-
<errorLevel type="suppress">
47-
<!--
48-
https://github.com/doctrine/dbal/pull/6607
49-
TODO: remove in 5.0.0
50-
-->
51-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\KeywordList" />
52-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\DB2Keywords" />
53-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\MariaDBKeywords" />
54-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\MySQLKeywords" />
55-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\MySQL84Keywords" />
56-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords" />
57-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\OracleKeywords" />
58-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords" />
59-
<referencedClass name="Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords" />
60-
<referencedClass name="Doctrine\DBAL\Platforms\MySQL84Platform" />
61-
</errorLevel>
62-
</DeprecatedClass>
6345
<DeprecatedMethod>
6446
<errorLevel type="suppress">
6547
<!--
@@ -73,24 +55,8 @@
7355

7456
<!-- TODO for PHPUnit 11 -->
7557
<referencedMethod name="PHPUnit\Framework\TestCase::iniSet"/>
76-
77-
<!--
78-
https://github.com/doctrine/dbal/pull/6607
79-
TODO: remove in 5.0.0
80-
-->
81-
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::createReservedKeywordsList" />
82-
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getReservedKeywordsList" />
8358
</errorLevel>
8459
</DeprecatedMethod>
85-
<DeprecatedProperty>
86-
<errorLevel type="suppress">
87-
<!--
88-
https://github.com/doctrine/dbal/pull/6607
89-
TODO: remove in 5.0.0
90-
-->
91-
<referencedProperty name="Doctrine\DBAL\Platforms\AbstractPlatform::$_keywords" />
92-
</errorLevel>
93-
</DeprecatedProperty>
9460
<DocblockTypeContradiction>
9561
<errorLevel type="suppress">
9662
<!--

src/Driver/AbstractMySQLDriver.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Doctrine\DBAL\Platforms\MariaDB1010Platform;
1313
use Doctrine\DBAL\Platforms\MariaDB1060Platform;
1414
use Doctrine\DBAL\Platforms\MariaDBPlatform;
15-
use Doctrine\DBAL\Platforms\MySQL84Platform;
1615
use Doctrine\DBAL\Platforms\MySQLPlatform;
1716
use Doctrine\DBAL\ServerVersionProvider;
1817

@@ -46,10 +45,6 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
4645
return new MariaDBPlatform();
4746
}
4847

49-
if (version_compare($version, '8.4.0', '>=')) {
50-
return new MySQL84Platform();
51-
}
52-
5348
return new MySQLPlatform();
5449
}
5550

src/Platforms/AbstractMySQLPlatform.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
use Doctrine\DBAL\Connection;
88
use Doctrine\DBAL\Exception;
99
use Doctrine\DBAL\Exception\InvalidColumnType\ColumnValuesRequired;
10-
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
11-
use Doctrine\DBAL\Platforms\Keywords\MySQLKeywords;
1210
use Doctrine\DBAL\Schema\AbstractAsset;
1311
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
1412
use Doctrine\DBAL\Schema\Index;
1513
use Doctrine\DBAL\Schema\MySQLSchemaManager;
1614
use Doctrine\DBAL\Schema\TableDiff;
1715
use Doctrine\DBAL\TransactionIsolationLevel;
1816
use Doctrine\DBAL\Types\Types;
19-
use Doctrine\Deprecations\Deprecation;
2017

2118
use function array_map;
2219
use function array_merge;
@@ -757,19 +754,6 @@ protected function initializeDoctrineTypeMappings(): void
757754
];
758755
}
759756

760-
/** @deprecated */
761-
protected function createReservedKeywordsList(): KeywordList
762-
{
763-
Deprecation::triggerIfCalledFromOutside(
764-
'doctrine/dbal',
765-
'https://github.com/doctrine/dbal/pull/6607',
766-
'%s is deprecated.',
767-
__METHOD__,
768-
);
769-
770-
return new MySQLKeywords();
771-
}
772-
773757
/**
774758
* {@inheritDoc}
775759
*

src/Platforms/AbstractPlatform.php

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Doctrine\DBAL\LockMode;
1717
use Doctrine\DBAL\Platforms\Exception\NoColumnsSpecifiedForTable;
1818
use Doctrine\DBAL\Platforms\Exception\NotSupported;
19-
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
2019
use Doctrine\DBAL\Schema\AbstractSchemaManager;
2120
use Doctrine\DBAL\Schema\Column;
2221
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
@@ -36,7 +35,6 @@
3635
use Doctrine\DBAL\Types;
3736
use Doctrine\DBAL\Types\Exception\TypeNotFound;
3837
use Doctrine\DBAL\Types\Type;
39-
use Doctrine\Deprecations\Deprecation;
4038

4139
use function addcslashes;
4240
use function array_map;
@@ -74,13 +72,6 @@ abstract class AbstractPlatform
7472
/** @var string[]|null */
7573
protected ?array $doctrineTypeMapping = null;
7674

77-
/**
78-
* Holds the KeywordList instance for the current platform.
79-
*
80-
* @deprecated
81-
*/
82-
protected ?KeywordList $_keywords = null;
83-
8475
/**
8576
* Returns the SQL snippet that declares a boolean column.
8677
*
@@ -2125,31 +2116,6 @@ public function rollbackSavePoint(string $savepoint): string
21252116
return 'ROLLBACK TO SAVEPOINT ' . $savepoint;
21262117
}
21272118

2128-
/**
2129-
* Returns the keyword list instance of this platform.
2130-
*
2131-
* @deprecated
2132-
*/
2133-
final public function getReservedKeywordsList(): KeywordList
2134-
{
2135-
Deprecation::triggerIfCalledFromOutside(
2136-
'doctrine/dbal',
2137-
'https://github.com/doctrine/dbal/pull/6607',
2138-
'%s is deprecated.',
2139-
__METHOD__,
2140-
);
2141-
2142-
// Store the instance so it doesn't need to be generated on every request.
2143-
return $this->_keywords ??= $this->createReservedKeywordsList();
2144-
}
2145-
2146-
/**
2147-
* Creates an instance of the reserved keyword list of this platform.
2148-
*
2149-
* @deprecated
2150-
*/
2151-
abstract protected function createReservedKeywordsList(): KeywordList;
2152-
21532119
/**
21542120
* Quotes a literal string.
21552121
* This method is NOT meant to fix SQL injections!

src/Platforms/DB2Platform.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
use Doctrine\DBAL\Connection;
88
use Doctrine\DBAL\Platforms\Exception\NotSupported;
9-
use Doctrine\DBAL\Platforms\Keywords\DB2Keywords;
10-
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
119
use Doctrine\DBAL\Schema\ColumnDiff;
1210
use Doctrine\DBAL\Schema\DB2SchemaManager;
1311
use Doctrine\DBAL\Schema\Identifier;
@@ -18,7 +16,6 @@
1816
use Doctrine\DBAL\TransactionIsolationLevel;
1917
use Doctrine\DBAL\Types\DateTimeType;
2018
use Doctrine\DBAL\Types\Types;
21-
use Doctrine\Deprecations\Deprecation;
2219

2320
use function array_merge;
2421
use function count;
@@ -592,19 +589,6 @@ public function supportsSavepoints(): bool
592589
return false;
593590
}
594591

595-
/** @deprecated */
596-
protected function createReservedKeywordsList(): KeywordList
597-
{
598-
Deprecation::triggerIfCalledFromOutside(
599-
'doctrine/dbal',
600-
'https://github.com/doctrine/dbal/pull/6607',
601-
'%s is deprecated.',
602-
__METHOD__,
603-
);
604-
605-
return new DB2Keywords();
606-
}
607-
608592
public function createSchemaManager(Connection $connection): DB2SchemaManager
609593
{
610594
return new DB2SchemaManager($connection, $this);

0 commit comments

Comments
 (0)