From 0992809d21d41f18b0b173ef47ffb041f80ff7a0 Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Thu, 7 Dec 2023 16:03:13 +0700 Subject: [PATCH] Fix `QueryBuilderTest::testBatchInsert()` (#283) Co-authored-by: Sergei Predvoditelev --- CHANGELOG.md | 1 + src/Schema.php | 7 +++---- tests/QueryBuilderTest.php | 11 ++++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24aa252d..b78d56f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Enh #281: Remove unused code in `Command` class (@vjik) - Enh #282: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov) +- Enh #283: Remove unnecessary check for array type in `Schema::loadTableIndexes()` (@Tigrov) ## 1.1.0 November 12, 2023 diff --git a/src/Schema.php b/src/Schema.php index cc88fcd4..23d46723 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -251,13 +251,12 @@ protected function loadTableForeignKeys(string $tableName): array * * @return array Indexes for the given table. * - * @psalm-return array|IndexConstraint[] + * @psalm-return IndexConstraint[] */ protected function loadTableIndexes(string $tableName): array { - $tableIndexes = $this->loadTableConstraints($tableName, self::INDEXES); - - return is_array($tableIndexes) ? $tableIndexes : []; + /** @var IndexConstraint[] */ + return $this->loadTableConstraints($tableName, self::INDEXES); } /** diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php index f5adf0b5..a54377ea 100644 --- a/tests/QueryBuilderTest.php +++ b/tests/QueryBuilderTest.php @@ -181,9 +181,14 @@ public function testAlterColumn(): void * @throws NotSupportedException * @throws Throwable */ - public function testBatchInsert(string $table, array $columns, iterable $rows, string $expected): void - { - parent::testBatchInsert($table, $columns, $rows, $expected); + public function testBatchInsert( + string $table, + array $columns, + iterable $rows, + string $expected, + array $expectedParams = [], + ): void { + parent::testBatchInsert($table, $columns, $rows, $expected, $expectedParams); } /**