Skip to content

Commit

Permalink
Merge pull request #5392 from morozov/column-length-deprecations
Browse files Browse the repository at this point in the history
Addition documentation for prior deprecations
  • Loading branch information
morozov authored May 14, 2022
2 parents c6be412 + c3ebfd0 commit b055317
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 0 deletions.
2 changes: 2 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getBinaryMaxLength"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getIsNullExpression"/>
<referencedMethod name="Doctrine\DBAL\Platforms\AbstractPlatform::getUniqueFieldDeclarationSQL"/>
<referencedMethod name="Doctrine\DBAL\Platforms\DB2Platform::getCharMaxLength"/>
<referencedMethod name="Doctrine\DBAL\Platforms\OraclePlatform::getBinaryMaxLength"/>
<!--
See https://github.com/doctrine/dbal/pull/5058
TODO: remove in 4.0.0
Expand Down
16 changes: 16 additions & 0 deletions src/Platforms/AbstractMySQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1111,17 +1111,33 @@ protected function initializeDoctrineTypeMappings()

/**
* {@inheritDoc}
*
* @deprecated
*/
public function getVarcharMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'AbstractMySQLPlatform::getVarcharMaxLength() is deprecated.'
);

return 65535;
}

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'AbstractMySQLPlatform::getBinaryMaxLength() is deprecated.'
);

return 65535;
}

Expand Down
27 changes: 27 additions & 0 deletions src/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,51 @@

class DB2Platform extends AbstractPlatform
{
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getCharMaxLength(): int
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'DB2Platform::getCharMaxLength() is deprecated.'
);

return 254;
}

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'DB2Platform::getBinaryMaxLength() is deprecated.'
);

return 32704;
}

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryDefaultLength()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'Relying on the default binary column length is deprecated, specify the length explicitly.'
);

return 1;
}

Expand Down
8 changes: 8 additions & 0 deletions src/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,17 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed/*, $length

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'OraclePlatform::getBinaryMaxLength() is deprecated.'
);

return 2000;
}

Expand Down
22 changes: 22 additions & 0 deletions src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1139,9 +1139,17 @@ protected function initializeDoctrineTypeMappings()

/**
* {@inheritDoc}
*
* @deprecated
*/
public function getVarcharMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'PostgreSQLPlatform::getVarcharMaxLength() is deprecated.'
);

return 65535;
}

Expand All @@ -1150,14 +1158,28 @@ public function getVarcharMaxLength()
*/
public function getBinaryMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'PostgreSQLPlatform::getBinaryMaxLength() is deprecated.'
);

return 0;
}

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryDefaultLength()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'Relying on the default binary column length is deprecated, specify the length explicitly.'
);

return 0;
}

Expand Down
8 changes: 8 additions & 0 deletions src/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1242,9 +1242,17 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed/*, $length

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'SQLServerPlatform::getBinaryMaxLength() is deprecated.'
);

return 8000;
}

Expand Down
16 changes: 16 additions & 0 deletions src/Platforms/SqlitePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,33 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryMaxLength()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'SqlitePlatform::getBinaryMaxLength() is deprecated.'
);

return 0;
}

/**
* {@inheritdoc}
*
* @deprecated
*/
public function getBinaryDefaultLength()
{
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/3263',
'Relying on the default binary column length is deprecated, specify the length explicitly.'
);

return 0;
}

Expand Down

0 comments on commit b055317

Please sign in to comment.