From f19738b0a546be37565b531d91fce73b1183d791 Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Sat, 10 Feb 2024 17:55:59 +0700 Subject: [PATCH 1/2] Resolve deprecated methods (#291) * Resolve deprecated methods * Add line to CHANGELOG.md [skip ci] * Fix test * Fix psalm issues --------- Co-authored-by: Sergei Predvoditelev --- CHANGELOG.md | 1 + src/Schema.php | 7 +++++-- tests/SchemaTest.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2b24f21..99a15a2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Enh #286: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov) - Bug #287: Fix `DMLQueryBuilder::insertWithReturningPks()` and `Command::insertWithReturningPks()` methods (@Tigrov) - Enh #292: Minor refactoring of `Command` and `Quoter` (@Tigrov) +- Enh #291: Resolve deprecated methods (@Tigrov) ## 1.1.0 November 12, 2023 diff --git a/src/Schema.php b/src/Schema.php index ca7a32c5..109fb07a 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -18,6 +18,7 @@ use Yiisoft\Db\Schema\ColumnSchemaInterface; use Yiisoft\Db\Schema\TableSchemaInterface; +use function array_map; use function explode; use function is_array; use function md5; @@ -328,7 +329,7 @@ protected function loadTableIndexes(string $tableName): array $indexes = $this->db->createCommand($sql, [':fullName' => $resolvedName->getFullName()])->queryAll(); /** @psalm-var array[] $indexes */ - $indexes = $this->normalizeRowKeyCase($indexes, true); + $indexes = array_map('array_change_key_case', $indexes); $indexes = DbArrayHelper::index($indexes, null, ['name']); $result = []; @@ -832,7 +833,7 @@ private function loadTableConstraints(string $tableName, string $returnType): mi $constraints = $this->db->createCommand($sql, [':fullName' => $resolvedName->getFullName()])->queryAll(); /** @psalm-var array[] $constraints */ - $constraints = $this->normalizeRowKeyCase($constraints, true); + $constraints = array_map('array_change_key_case', $constraints); $constraints = DbArrayHelper::index($constraints, null, ['type', 'name']); $result = [ @@ -901,6 +902,8 @@ private function loadTableConstraints(string $tableName, string $returnType): mi * @param string $name The table name. * * @return array The cache key. + * + * @psalm-suppress DeprecatedMethod */ protected function getCacheKey(string $name): array { diff --git a/tests/SchemaTest.php b/tests/SchemaTest.php index ab15dd7c..58d2a9ee 100644 --- a/tests/SchemaTest.php +++ b/tests/SchemaTest.php @@ -177,7 +177,7 @@ public function testNotConnectionPDO(): void $this->expectException(NotSupportedException::class); $this->expectExceptionMessage('Only PDO connections are supported.'); - $schema->refreshTableSchema('customer'); + $schema->refresh(); } public function testNegativeDefaultValues(): void From 276af87bde21f2e8546de08350ebc92aa91a44c0 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Sun, 11 Feb 2024 17:16:34 -0300 Subject: [PATCH 2/2] Fix workflow mutation. (#295) --- .github/workflows/mutation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 669a9c63..bb184b91 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -84,6 +84,6 @@ jobs: - name: Run infection. run: | - vendor/bin/roave-infection-static-analysis-plugin -j2 --ignore-msi-with-no-mutations --only-covered + vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ignore-msi-with-no-mutations --only-covered env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}