Skip to content

Commit

Permalink
Merge pull request #5433 from morozov/deprecate-keyword-list-get-name
Browse files Browse the repository at this point in the history
Deprecate KeywordList::getName()
  • Loading branch information
morozov authored Jun 6, 2022
2 parents 4be7e2f + 82901c4 commit 2c39af8
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 2 deletions.
9 changes: 7 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ awareness about deprecated code.

## Deprecated the functionality of checking schema for the usage of reserved keywords.

The `dbal:reserved-words` console command and the `ReservedWordsCommand` and `ReservedKeywordsValidator` classes
have been deprecated. Use the documentation on the used database platform(s) instead.
The following components have been deprecated:

1. The `dbal:reserved-words` console command.
2. The `ReservedWordsCommand` and `ReservedKeywordsValidator` classes.
3. The `KeywordList::getName()` method.

Use the documentation on the used database platform(s) instead.

## Deprecated `CreateSchemaSqlCollector` and `DropSchemaSqlCollector`.

Expand Down
4 changes: 4 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::supportsForeignKeyConstraints"/>
<!--
TODO: remove in 4.0.0
-->
<referencedMethod name="Doctrine\DBAL\Platforms\Keywords\KeywordList::getName"/>
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
Expand Down
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/DB2Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* DB2 Keywords.
*/
class DB2Keywords extends KeywordList
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'DB2Keywords::getName() is deprecated.'
);

return 'DB2';
}

Expand Down
2 changes: 2 additions & 0 deletions src/Platforms/Keywords/KeywordList.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ abstract protected function getKeywords();
/**
* Returns the name of this keyword list.
*
* @deprecated
*
* @return string
*/
abstract public function getName();
Expand Down
11 changes: 11 additions & 0 deletions src/Platforms/Keywords/MariaDBKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,21 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

class MariaDBKeywords extends MySQLKeywords
{
/**
* @deprecated
*/
public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MariaDBKeywords::getName() is deprecated.'
);

return 'MariaDB';
}

Expand Down
11 changes: 11 additions & 0 deletions src/Platforms/Keywords/MariaDb102Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* MariaDb reserved keywords list.
*
Expand All @@ -11,8 +13,17 @@
*/
final class MariaDb102Keywords extends MariaDBKeywords
{
/**
* @deprecated
*/
public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MariaDb102Keywords::getName() is deprecated.'
);

return 'MariaDb102';
}
}
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/MySQL57Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* MySQL 5.7 reserved keywords list.
*
Expand All @@ -11,9 +13,17 @@ class MySQL57Keywords extends MySQLKeywords
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MySQL57Keywords::getName() is deprecated.'
);

return 'MySQL57';
}

Expand Down
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/MySQL80Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

use function array_merge;

/**
Expand All @@ -11,9 +13,17 @@ class MySQL80Keywords extends MySQL57Keywords
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MySQL80Keywords::getName() is deprecated.'
);

return 'MySQL80';
}

Expand Down
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/MySQLKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* MySQL Keywordlist.
*/
class MySQLKeywords extends KeywordList
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MySQLKeywords::getName() is deprecated.'
);

return 'MySQL';
}

Expand Down
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/OracleKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* Oracle Keywordlist.
*/
class OracleKeywords extends KeywordList
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'OracleKeywords::getName() is deprecated.'
);

return 'Oracle';
}

Expand Down
11 changes: 11 additions & 0 deletions src/Platforms/Keywords/PostgreSQL100Keywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* PostgreSQL 10.0 reserved keywords list.
*
* @deprecated Use {@link PostgreSQLKeywords} instead.
*/
class PostgreSQL100Keywords extends PostgreSQL94Keywords
{
/**
* @deprecated
*/
public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'PostgreSQL100Keywords::getName() is deprecated.'
);

return 'PostgreSQL100';
}
}
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/PostgreSQLKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* Reserved keywords list corresponding to the PostgreSQL database platform of the oldest supported version.
*/
class PostgreSQLKeywords extends KeywordList
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'PostgreSQLKeywords::getName() is deprecated.'
);

return 'PostgreSQL';
}

Expand Down
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/SQLServerKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* Microsoft SQL Server 2012 reserved keyword dictionary.
* Reserved keywords list corresponding to the Microsoft SQL Server database platform of the oldest supported version.
Expand All @@ -10,9 +12,17 @@ class SQLServerKeywords extends KeywordList
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'SQLServerKeywords::getName() is deprecated.'
);

return 'SQLServer';
}

Expand Down
10 changes: 10 additions & 0 deletions src/Platforms/Keywords/SQLiteKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@

namespace Doctrine\DBAL\Platforms\Keywords;

use Doctrine\Deprecations\Deprecation;

/**
* SQLite Keywordlist.
*/
class SQLiteKeywords extends KeywordList
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'SQLiteKeywords::getName() is deprecated.'
);

return 'SQLite';
}

Expand Down

0 comments on commit 2c39af8

Please sign in to comment.