Replace DBALException::invalidTableName() with InvalidTableName

parent 2efcbe2f
......@@ -35,6 +35,10 @@ The following classes have been renamed:
3. The `PDOSqlsrv\Connection` and `PDOSqlsrv\Statement` classes have been made final and no longer extend the corresponding PDO classes.
4. The `SQLSrv\LastInsertId` class has been made final.
## BC BREAK: Changes in wrapper-level exceptions
1. `DBALException::invalidTableName()` has been replaced with the `InvalidTableName` class.
## BC BREAK: Changes in driver-level exception handling
1. The `convertException()` method has been removed from the `Driver` interface. The logic of exception conversion has been moved to the `ExceptionConverter` interface. The drivers now must implement the `getExceptionConverter()` method.
......
......@@ -126,16 +126,6 @@ class DBALException extends Exception
return new self("The given 'driverClass' " . $driverClass . ' has to implement the ' . Driver::class . ' interface.');
}
/**
* @param string $tableName
*
* @return DBALException
*/
public static function invalidTableName($tableName)
{
return new self('Invalid table name specified: ' . $tableName);
}
/**
* @param string $tableName
*
......
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class InvalidTableName extends SchemaException
{
public static function new(string $tableName): self
{
return new self(sprintf('Invalid table name specified "%s".', $tableName));
}
}
......@@ -3,6 +3,7 @@
namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\Exception\InvalidTableName;
use Doctrine\DBAL\Schema\Visitor\Visitor;
use Doctrine\DBAL\Types\Type;
......@@ -51,12 +52,12 @@ class Table extends AbstractAsset
* @param int $idGeneratorType
* @param mixed[] $options
*
* @throws DBALException
* @throws SchemaException
*/
public function __construct($tableName, array $columns = [], array $indexes = [], array $fkConstraints = [], $idGeneratorType = 0, array $options = [])
{
if (strlen($tableName) === 0) {
throw DBALException::invalidTableName($tableName);
throw InvalidTableName::new($tableName);
}
$this->_setName($tableName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment