From 948b8ca3f348a88216dd05514893eafa4f552a30 Mon Sep 17 00:00:00 2001 From: Tofandel Date: Fri, 26 Jan 2024 14:42:22 +0100 Subject: [PATCH] Static analysis --- tests/Platforms/AbstractPlatformTestCase.php | 29 ++------------------ tests/Platforms/DB2PlatformTest.php | 2 +- tests/Platforms/SQLServerPlatformTest.php | 6 ++-- tests/Platforms/SQLitePlatformTest.php | 4 +-- 4 files changed, 8 insertions(+), 33 deletions(-) diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index e58a68ec0ba..ac0cc8422a1 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -477,7 +477,7 @@ public function testAlterTableChangeQuotedColumn(): void $table->addColumn('select', Types::INTEGER); $tableDiff = new TableDiff($table, changedColumns: [ - new ColumnDiff( + 'select' => new ColumnDiff( $table->getColumn('select'), new Column( 'select', @@ -859,7 +859,7 @@ public function testAlterStringToFixedString(): void $table->addColumn('name', Types::STRING, ['length' => 2]); $tableDiff = new TableDiff($table, changedColumns: [ - new ColumnDiff( + 'name' => new ColumnDiff( $table->getColumn('name'), new Column( 'name', @@ -985,28 +985,3 @@ public static function asciiStringSqlDeclarationDataProvider(): array ]; } } - -interface GetCreateTableSqlDispatchEventListener -{ - public function onSchemaCreateTable(): void; - - public function onSchemaCreateTableColumn(): void; -} - -interface GetAlterTableSqlDispatchEventListener -{ - public function onSchemaAlterTable(SchemaAlterTableEventArgs $args): void; - - public function onSchemaAlterTableAddColumn(SchemaAlterTableAddColumnEventArgs $args): void; - - public function onSchemaAlterTableRemoveColumn(SchemaAlterTableRemoveColumnEventArgs $args): void; - - public function onSchemaAlterTableChangeColumn(SchemaAlterTableChangeColumnEventArgs $args): void; - - public function onSchemaAlterTableRenameColumn(SchemaAlterTableRenameColumnEventArgs $args): void; -} - -interface GetDropTableSqlDispatchEventListener -{ - public function onSchemaDropTable(): void; -} diff --git a/tests/Platforms/DB2PlatformTest.php b/tests/Platforms/DB2PlatformTest.php index c3e064bb599..44a1df0dff3 100644 --- a/tests/Platforms/DB2PlatformTest.php +++ b/tests/Platforms/DB2PlatformTest.php @@ -448,7 +448,7 @@ public function testGeneratesAlterColumnSQL( bool $shouldReorg = true, ): void { $tableDiff = new TableDiff(new Table('foo'), changedColumns: [ - new ColumnDiff($oldColumn, $newColumn), + $oldColumn->getName() => new ColumnDiff($oldColumn, $newColumn), ]); $expectedSQL = []; diff --git a/tests/Platforms/SQLServerPlatformTest.php b/tests/Platforms/SQLServerPlatformTest.php index 7aedcc4759a..ae8b612a094 100644 --- a/tests/Platforms/SQLServerPlatformTest.php +++ b/tests/Platforms/SQLServerPlatformTest.php @@ -668,7 +668,7 @@ public function testAlterTableWithSchemaDropColumnComments(): void $table = new Table('testschema.mytable'); $tableDiff = new TableDiff($table, changedColumns: [ - new ColumnDiff( + 'quota' => new ColumnDiff( new Column('quota', Type::getType(Types::INTEGER), ['comment' => 'A comment']), new Column('quota', Type::getType(Types::INTEGER), []), ), @@ -687,7 +687,7 @@ public function testAlterTableWithSchemaUpdateColumnComments(): void $table = new Table('testschema.mytable'); $tableDiff = new TableDiff($table, changedColumns: [ - new ColumnDiff( + 'quota' => new ColumnDiff( new Column('quota', Type::getType(Types::INTEGER), ['comment' => 'A comment']), new Column('quota', Type::getType(Types::INTEGER), ['comment' => 'B comment']), ), @@ -1062,7 +1062,7 @@ public function testAlterTableWithSchemaSameColumnComments(): void $table = new Table('testschema.mytable'); $tableDiff = new TableDiff($table, changedColumns: [ - new ColumnDiff( + 'quota' => new ColumnDiff( new Column('quota', Type::getType(Types::INTEGER), ['comment' => 'A comment', 'notnull' => false]), new Column('quota', Type::getType(Types::INTEGER), ['comment' => 'A comment', 'notnull' => true]), ), diff --git a/tests/Platforms/SQLitePlatformTest.php b/tests/Platforms/SQLitePlatformTest.php index f8b19c1395b..4a446e0a8d5 100644 --- a/tests/Platforms/SQLitePlatformTest.php +++ b/tests/Platforms/SQLitePlatformTest.php @@ -303,11 +303,11 @@ public function testAlterTable(): void $diff = new TableDiff( $table, changedColumns: [ - new ColumnDiff( + 'id' => new ColumnDiff( $table->getColumn('id'), new Column('key', Type::getType(Types::INTEGER)), ), - new ColumnDiff( + 'post' => new ColumnDiff( $table->getColumn('post'), new Column('comment', Type::getType(Types::INTEGER)), ),