Skip to content

Commit

Permalink
Merge pull request #6657 from morozov/deprecate-shortest-name
Browse files Browse the repository at this point in the history
Deprecate AbstractAsset::getShortestName()
  • Loading branch information
morozov authored Dec 21, 2024
2 parents 582633f + 8d572df commit e7e2615
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ awareness about deprecated code.

# Upgrade to 4.3

## Deprecated `AbstractAsset::getShortestName()`

The `AbstractAsset::getShortestName()` method has been deprecated. Use `AbstractAsset::getName()` instead.

## Deprecated `Sequence::isAutoIncrementsFor()`

The `Sequence::isAutoIncrementsFor()` method has been deprecated.
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@
TODO: remove in 5.0.0
-->
<referencedMethod name="Doctrine\DBAL\Schema\Sequence::isAutoIncrementsFor" />

<!--
https://github.com/doctrine/dbal/pull/6657
TODO: remove in 5.0.0
-->
<referencedMethod name="Doctrine\DBAL\Schema\AbstractAsset::getShortestName" />
</errorLevel>
</DeprecatedMethod>
<DeprecatedProperty>
Expand Down
9 changes: 9 additions & 0 deletions src/Schema/AbstractAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,18 @@ public function getNamespaceName(): ?string
/**
* The shortest name is stripped of the default namespace. All other
* namespaced elements are returned as full-qualified names.
*
* @deprecated Use {@link getName()} instead.
*/
public function getShortestName(?string $defaultNamespaceName): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6657',
'%s is deprecated and will be removed in 5.0.',
__METHOD__,
);

$shortestName = $this->getName();
if ($this->_namespace === $defaultNamespaceName) {
$shortestName = $this->_name;
Expand Down

0 comments on commit e7e2615

Please sign in to comment.