diff --git a/UPGRADE.md b/UPGRADE.md index 64ba7434353..4b552e980dd 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,13 @@ # 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\DBALException` class renamed + +The `Doctrine\DBAL\DBALException` class has been renamed to `Doctrine\DBAL\Exception`. + ## BC BREAK: Doctrine\DBAL\Schema\Table constructor new parameter Deprecated parameter `$idGeneratorType` removed and added a new parameter `$uniqueConstraints`. diff --git a/src/DBALException.php b/src/DBALException.php deleted file mode 100644 index b4d55ae4184..00000000000 --- a/src/DBALException.php +++ /dev/null @@ -1,199 +0,0 @@ -supportsForeignKeyConstraints(); - } - /** * Whether the platform supports database schemas. * diff --git a/src/Types/StringType.php b/src/Types/StringType.php index 9a510effc7e..4e7bd55d07c 100644 --- a/src/Types/StringType.php +++ b/src/Types/StringType.php @@ -17,14 +17,6 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform) return $platform->getVarcharTypeDeclarationSQL($column); } - /** - * {@inheritdoc} - */ - public function getDefaultLength(AbstractPlatform $platform) - { - return $platform->getVarcharDefaultLength(); - } - /** * {@inheritdoc} */ diff --git a/src/Types/Type.php b/src/Types/Type.php index 2395c12aa4b..6ba46f4f7b0 100644 --- a/src/Types/Type.php +++ b/src/Types/Type.php @@ -89,18 +89,6 @@ public function convertToPHPValue($value, AbstractPlatform $platform) return $value; } - /** - * Gets the default length of this type. - * - * @deprecated Rely on information provided by the platform instead. - * - * @return int|null - */ - public function getDefaultLength(AbstractPlatform $platform) - { - return null; - } - /** * Gets the SQL declaration snippet for a column of this type. * diff --git a/tests/DBALExceptionTest.php b/tests/ExceptionTest.php similarity index 76% rename from tests/DBALExceptionTest.php rename to tests/ExceptionTest.php index 2de2a0dc392..3ae3b3cb411 100644 --- a/tests/DBALExceptionTest.php +++ b/tests/ExceptionTest.php @@ -2,20 +2,20 @@ namespace Doctrine\DBAL\Tests; -use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Exception; use PHPUnit\Framework\TestCase; use stdClass; use function sprintf; -class DBALExceptionTest extends TestCase +class ExceptionTest extends TestCase { public function testDriverRequiredWithUrl(): void { $url = 'mysql://localhost'; - $exception = DBALException::driverRequired($url); + $exception = Exception::driverRequired($url); - self::assertInstanceOf(DBALException::class, $exception); + self::assertInstanceOf(Exception::class, $exception); self::assertSame( sprintf( "The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " . @@ -28,7 +28,7 @@ public function testDriverRequiredWithUrl(): void public function testInvalidPlatformTypeObject(): void { - $exception = DBALException::invalidPlatformType(new stdClass()); + $exception = Exception::invalidPlatformType(new stdClass()); self::assertSame( "Option 'platform' must be a subtype of 'Doctrine\DBAL\Platforms\AbstractPlatform', " @@ -39,7 +39,7 @@ public function testInvalidPlatformTypeObject(): void public function testInvalidPlatformTypeScalar(): void { - $exception = DBALException::invalidPlatformType('some string'); + $exception = Exception::invalidPlatformType('some string'); self::assertSame( "Option 'platform' must be an object and subtype of 'Doctrine\DBAL\Platforms\AbstractPlatform'. " diff --git a/tests/Types/StringTest.php b/tests/Types/StringTest.php index 49c5c923dcc..dd64385f311 100644 --- a/tests/Types/StringTest.php +++ b/tests/Types/StringTest.php @@ -31,15 +31,6 @@ public function testReturnsSqlDeclarationFromPlatformVarchar(): void self::assertEquals('TEST_VARCHAR', $this->type->getSQLDeclaration([], $this->platform)); } - public function testReturnsDefaultLengthFromPlatformVarchar(): void - { - $this->platform->expects(self::once()) - ->method('getVarcharDefaultLength') - ->willReturn(255); - - self::assertEquals(255, $this->type->getDefaultLength($this->platform)); - } - public function testConvertToPHPValue(): void { self::assertIsString($this->type->convertToPHPValue('foo', $this->platform));