Skip to content

Commit

Permalink
Merge pull request doctrine#3518 from Majkl578/drop-deprecated
Browse files Browse the repository at this point in the history
Remove @​deprecated stuff
  • Loading branch information
morozov committed Aug 26, 2019
2 parents 33ea073 + 8be4d67 commit 7b89214
Show file tree
Hide file tree
Showing 24 changed files with 125 additions and 783 deletions.
15 changes: 15 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Upgrade to 3.0

## BC BREAK Removed previously deprecated features

* Removed `json_array` type and all associated hacks.
* Removed `Connection::TRANSACTION_*` constants.
* Removed `AbstractPlatform::DATE_INTERVAL_UNIT_*` and `AbstractPlatform::TRIM_*` constants.
* Removed `MysqlSessionInit` listener.
* Removed `MysqlPlatform::getCollationFieldDeclaration()`.
* Removed `AbstractPlatform::getIdentityColumnNullInsertSQL()`.
* Removed `Table::addUnnamedForeignKeyConstraint()` and `Table::addNamedForeignKeyConstraint()`.
* Removed `Table::renameColumn()`.
* Removed `SQLParserUtils::getPlaceholderPositions()`.
* Removed `AbstractSchemaManager::getFilterSchemaAssetsExpression()`, `Configuration::getFilterSchemaAssetsExpression()`
and `Configuration::getFilterSchemaAssetsExpression()`.
* `SQLParserUtils::*_TOKEN` constants made private.

## BC BREAK `Connection::ping()` returns `void`.

`Connection::ping()` and `PingableConnection::ping()` no longer return a boolean value. They will throw an exception in case of failure.
Expand Down
12 changes: 0 additions & 12 deletions lib/Doctrine/DBAL/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,6 @@ public function setFilterSchemaAssetsExpression($filterExpression)
}
}

/**
* Returns filter schema assets expression.
*
* @deprecated Use Configuration::getSchemaAssetsFilter() instead
*
* @return string|null
*/
public function getFilterSchemaAssetsExpression()
{
return $this->_attributes['filterSchemaAssetsExpression'] ?? null;
}

/**
* @param string $filterExpression
*/
Expand Down
28 changes: 0 additions & 28 deletions lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,6 @@
*/
class Connection implements DriverConnection
{
/**
* Constant for transaction isolation level READ UNCOMMITTED.
*
* @deprecated Use TransactionIsolationLevel::READ_UNCOMMITTED.
*/
public const TRANSACTION_READ_UNCOMMITTED = TransactionIsolationLevel::READ_UNCOMMITTED;

/**
* Constant for transaction isolation level READ COMMITTED.
*
* @deprecated Use TransactionIsolationLevel::READ_COMMITTED.
*/
public const TRANSACTION_READ_COMMITTED = TransactionIsolationLevel::READ_COMMITTED;

/**
* Constant for transaction isolation level REPEATABLE READ.
*
* @deprecated Use TransactionIsolationLevel::REPEATABLE_READ.
*/
public const TRANSACTION_REPEATABLE_READ = TransactionIsolationLevel::REPEATABLE_READ;

/**
* Constant for transaction isolation level SERIALIZABLE.
*
* @deprecated Use TransactionIsolationLevel::SERIALIZABLE.
*/
public const TRANSACTION_SERIALIZABLE = TransactionIsolationLevel::SERIALIZABLE;

/**
* Represents an array of ints to be expanded by Doctrine SQL parsing.
*/
Expand Down
60 changes: 0 additions & 60 deletions lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php

This file was deleted.

70 changes: 0 additions & 70 deletions lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,66 +70,6 @@ abstract class AbstractPlatform

public const CREATE_FOREIGNKEYS = 2;

/**
* @deprecated Use DateIntervalUnit::INTERVAL_UNIT_SECOND.
*/
public const DATE_INTERVAL_UNIT_SECOND = DateIntervalUnit::SECOND;

/**
* @deprecated Use DateIntervalUnit::MINUTE.
*/
public const DATE_INTERVAL_UNIT_MINUTE = DateIntervalUnit::MINUTE;

/**
* @deprecated Use DateIntervalUnit::HOUR.
*/
public const DATE_INTERVAL_UNIT_HOUR = DateIntervalUnit::HOUR;

/**
* @deprecated Use DateIntervalUnit::DAY.
*/
public const DATE_INTERVAL_UNIT_DAY = DateIntervalUnit::DAY;

/**
* @deprecated Use DateIntervalUnit::WEEK.
*/
public const DATE_INTERVAL_UNIT_WEEK = DateIntervalUnit::WEEK;

/**
* @deprecated Use DateIntervalUnit::MONTH.
*/
public const DATE_INTERVAL_UNIT_MONTH = DateIntervalUnit::MONTH;

/**
* @deprecated Use DateIntervalUnit::QUARTER.
*/
public const DATE_INTERVAL_UNIT_QUARTER = DateIntervalUnit::QUARTER;

/**
* @deprecated Use DateIntervalUnit::QUARTER.
*/
public const DATE_INTERVAL_UNIT_YEAR = DateIntervalUnit::YEAR;

/**
* @deprecated Use TrimMode::UNSPECIFIED.
*/
public const TRIM_UNSPECIFIED = TrimMode::UNSPECIFIED;

/**
* @deprecated Use TrimMode::LEADING.
*/
public const TRIM_LEADING = TrimMode::LEADING;

/**
* @deprecated Use TrimMode::TRAILING.
*/
public const TRIM_TRAILING = TrimMode::TRAILING;

/**
* @deprecated Use TrimMode::BOTH.
*/
public const TRIM_BOTH = TrimMode::BOTH;

/** @var string[]|null */
protected $doctrineTypeMapping = null;

Expand Down Expand Up @@ -3223,16 +3163,6 @@ public function hasNativeJsonType()
return false;
}

/**
* @deprecated
*
* @todo Remove in 3.0
*/
public function getIdentityColumnNullInsertSQL()
{
return '';
}

/**
* Whether this platform supports views.
*
Expand Down
16 changes: 0 additions & 16 deletions lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,22 +290,6 @@ public function getBooleanTypeDeclarationSQL(array $field)
return 'TINYINT(1)';
}

/**
* Obtain DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration to be used in statements like CREATE TABLE.
*
* @deprecated Deprecated since version 2.5, Use {@link self::getColumnCollationDeclarationSQL()} instead.
*
* @param string $collation name of the collation
*
* @return string DBMS specific SQL code portion needed to set the COLLATION
* of a field declaration.
*/
public function getCollationFieldDeclaration($collation)
{
return $this->getColumnCollationDeclarationSQL($collation);
}

/**
* {@inheritDoc}
*
Expand Down
27 changes: 4 additions & 23 deletions lib/Doctrine/DBAL/SQLParserUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,21 @@
*/
class SQLParserUtils
{
private const POSITIONAL_TOKEN = '\?';
private const NAMED_TOKEN = '(?<!:):[a-zA-Z_][a-zA-Z0-9_]*';

/**#@+
* Quote characters within string literals can be preceded by a backslash.
*
* @deprecated Will be removed as internal implementation details.
*/
public const POSITIONAL_TOKEN = '\?';
public const NAMED_TOKEN = '(?<!:):[a-zA-Z_][a-zA-Z0-9_]*';
// Quote characters within string literals can be preceded by a backslash.
public const ESCAPED_SINGLE_QUOTED_TEXT = "(?:'(?:\\\\\\\\)+'|'(?:[^'\\\\]|\\\\'?|'')*')";
public const ESCAPED_DOUBLE_QUOTED_TEXT = '(?:"(?:\\\\\\\\)+"|"(?:[^"\\\\]|\\\\"?)*")';
public const ESCAPED_BACKTICK_QUOTED_TEXT = '(?:`(?:\\\\\\\\)+`|`(?:[^`\\\\]|\\\\`?)*`)';
/**#@-*/

private const ESCAPED_BRACKET_QUOTED_TEXT = '(?<!\b(?i:ARRAY))\[(?:[^\]])*\]';

/**
* Gets an array of the placeholders in an sql statements as keys and their positions in the query string.
*
* For a statement with positional parameters, returns a zero-indexed list of placeholder position.
* For a statement with named parameters, returns a map of placeholder positions to their parameter names.
*
* @deprecated Will be removed as internal implementation detail.
*
* @param string $statement
* @param bool $isPositional
*
* @return int[]|string[]
*/
public static function getPlaceholderPositions($statement, $isPositional = true)
{
return $isPositional
? self::getPositionalPlaceholderPositions($statement)
: self::getNamedPlaceholderPositions($statement);
}

/**
* Returns a zero-indexed list of placeholder position.
*
Expand Down
10 changes: 0 additions & 10 deletions lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,6 @@ protected function filterAssetNames($assetNames)
return array_values(array_filter($assetNames, $filter));
}

/**
* @deprecated Use Configuration::getSchemaAssetsFilter() instead
*
* @return string|null
*/
protected function getFilterSchemaAssetsExpression()
{
return $this->_conn->getConfiguration()->getFilterSchemaAssetsExpression();
}

/**
* Lists the tables for this connection.
*
Expand Down
23 changes: 0 additions & 23 deletions lib/Doctrine/DBAL/Schema/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use function array_keys;
use function array_map;
use function array_merge;
use function array_shift;
use function array_unique;
use function assert;
use function count;
Expand Down Expand Up @@ -436,13 +435,6 @@ public function diffColumn(Column $column1, Column $column2)
$changedProperties[] = $property;
}

// This is a very nasty hack to make comparator work with the legacy json_array type, which should be killed in v3
if ($this->isALegacyJsonComparison($properties1['type'], $properties2['type'])) {
array_shift($changedProperties);

$changedProperties[] = 'comment';
}

// Null values need to be checked additionally as they tell whether to create or drop a default value.
// null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation.
if (($properties1['default'] === null) !== ($properties2['default'] === null)
Expand Down Expand Up @@ -505,21 +497,6 @@ public function diffColumn(Column $column1, Column $column2)
return array_unique($changedProperties);
}

/**
* TODO: kill with fire on v3.0
*
* @deprecated
*/
private function isALegacyJsonComparison(Types\Type $one, Types\Type $other) : bool
{
if (! $one instanceof Types\JsonType || ! $other instanceof Types\JsonType) {
return false;
}

return ( ! $one instanceof Types\JsonArrayType && $other instanceof Types\JsonArrayType)
|| ( ! $other instanceof Types\JsonArrayType && $one instanceof Types\JsonArrayType);
}

/**
* Finds the difference between the indexes $index1 and $index2.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ protected function _getPortableTableColumnDefinition($tableColumn)
$column->setPlatformOption('collation', $tableColumn['collation']);
}

if (in_array($column->getType()->getName(), [Types::JSON_ARRAY, Types::JSON], true)) {
if ($column->getType()->getName() === Types::JSON) {
$column->setPlatformOption('jsonb', $jsonb);
}

Expand Down
Loading

0 comments on commit 7b89214

Please sign in to comment.