Skip to content

Commit

Permalink
Merge pull request #3255 from Majkl578/dev/removal/Type-getDefaultLength
Browse files Browse the repository at this point in the history
Remove Doctrine\DBAL\Types\Type::getDefaultLength()
  • Loading branch information
Ocramius authored Aug 19, 2018
2 parents b59f84b + 1306c3d commit 40c4f38
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Upgrade to 3.0

## BC BREAK: `Doctrine\DBAL\Types\Type::getDefaultLength()` removed

The `Doctrine\DBAL\Types\Type::getDefaultLength()` method has been removed as it served no purpose.

## BC BREAK: `Doctrine\DBAL\Types\Type::__toString()` removed

Relying on string representation was discouraged and has been removed.
Expand Down
8 changes: 0 additions & 8 deletions lib/Doctrine/DBAL/Types/StringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla
return $platform->getVarcharTypeDeclarationSQL($fieldDeclaration);
}

/**
* {@inheritdoc}
*/
public function getDefaultLength(AbstractPlatform $platform)
{
return $platform->getVarcharDefaultLength();
}

/**
* {@inheritdoc}
*/
Expand Down
14 changes: 0 additions & 14 deletions lib/Doctrine/DBAL/Types/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ public function convertToPHPValue($value, AbstractPlatform $platform)
return $value;
}

/**
* Gets the default length of this type.
*
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
*
* @return int|null
*
* @todo Needed?
*/
public function getDefaultLength(AbstractPlatform $platform)
{
return null;
}

/**
* Gets the SQL declaration snippet for a field of this type.
*
Expand Down
5 changes: 0 additions & 5 deletions tests/Doctrine/Tests/DBAL/Types/StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ public function testReturnsSqlDeclarationFromPlatformVarchar()
self::assertEquals("DUMMYVARCHAR()", $this->_type->getSqlDeclaration(array(), $this->_platform));
}

public function testReturnsDefaultLengthFromPlatformVarchar()
{
self::assertEquals(255, $this->_type->getDefaultLength($this->_platform));
}

public function testConvertToPHPValue()
{
self::assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform));
Expand Down

0 comments on commit 40c4f38

Please sign in to comment.