diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index 949cd4509df..3ee2b897893 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -904,7 +904,7 @@ protected function _getPortableViewsList(array $views) : array */ protected function _getPortableViewDefinition(array $view) : View { - throw DBALException::notSupported('Views'); + throw NotSupported::new('Views'); } /** diff --git a/lib/Doctrine/DBAL/Schema/Exception/NamedIndexRequired.php b/lib/Doctrine/DBAL/Schema/Exception/NamedIndexRequired.php new file mode 100644 index 00000000000..ee68122eefa --- /dev/null +++ b/lib/Doctrine/DBAL/Schema/Exception/NamedIndexRequired.php @@ -0,0 +1,25 @@ +getName(), + implode(', ', $index->getColumns()) + ) + ); + } +} diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index 1cf6e22810b..e6ecbf8a6e5 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -22,6 +22,7 @@ use function preg_replace; use function rtrim; use function sprintf; +use function str_replace; use function strpos; use function strtolower; use function trim; diff --git a/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php b/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php index fe4d9465086..15e1d3826be 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\Exception\NamedForeignKeyRequired; use Doctrine\DBAL\Schema\ForeignKeyConstraint; -use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; use SplObjectStorage; @@ -49,7 +48,7 @@ public function acceptTable(Table $table) : void public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void { if ($fkConstraint->getName() === null) { - throw SchemaException::namedForeignKeyRequired($localTable, $fkConstraint); + throw NamedForeignKeyRequired::new($localTable, $fkConstraint); } $this->constraints->attach($fkConstraint, $localTable); diff --git a/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php b/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php index cc6ad2d005d..5747292a905 100644 --- a/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php +++ b/lib/Doctrine/DBAL/Schema/Visitor/RemoveNamespacedAssets.php @@ -4,6 +4,7 @@ namespace Doctrine\DBAL\Schema\Visitor; +use Doctrine\DBAL\Schema\Exception\NamedForeignKeyRequired; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; @@ -90,7 +91,7 @@ private function removeForeignKey(Table $table, ForeignKeyConstraint $constraint $name = $constraint->getName(); if ($name === null) { - throw SchemaException::namedForeignKeyRequired($table, $constraint); + throw NamedForeignKeyRequired::new($table, $constraint); } $table->removeForeignKey($name); diff --git a/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php b/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php index 6d9c70cd7eb..cbf8e1fbeb0 100644 --- a/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php +++ b/lib/Doctrine/DBAL/Sharding/SQLAzure/Schema/MultiTenantVisitor.php @@ -5,6 +5,7 @@ namespace Doctrine\DBAL\Sharding\SQLAzure\Schema; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\Exception\NamedIndexRequired; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Schema; @@ -91,7 +92,7 @@ public function acceptTable(Table $table) : void $name = $clusteredIndex->getName(); if ($name === null) { - throw SchemaException::namedIndexRequired($table, $clusteredIndex); + throw NamedIndexRequired::new($table, $clusteredIndex); } $table->dropIndex($name); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php index c282d42220c..3dd362e2263 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php @@ -40,6 +40,8 @@ protected function setUp() : void } /** + * @param mixed $expectedDefault + * * @dataProvider columnProvider */ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $expectedDefault) : void @@ -55,6 +57,8 @@ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $ } /** + * @param mixed $expectedDefault + * * @dataProvider columnProvider */ public function testEscapedDefaultValueCanBeInserted(string $name, ?string $expectedDefault) : void