From 239aacb34f28014a7d7f25b070b7bda4ca464f43 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Mon, 29 Jan 2024 11:23:40 +0700 Subject: [PATCH 1/4] Resolve deprecated methods --- src/Schema.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Schema.php b/src/Schema.php index ca7a32c5..a2ec3031 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 = [ @@ -904,7 +905,7 @@ private function loadTableConstraints(string $tableName, string $returnType): mi */ protected function getCacheKey(string $name): array { - return array_merge([self::class], $this->generateCacheKey(), [$this->getRawTableName($name)]); + return array_merge([self::class], $this->generateCacheKey(), [$this->db->getQuoter()->getRawTableName($name)]); } /** From b9d43f4601fea33f850f6efc4a31e83879cd4fcd Mon Sep 17 00:00:00 2001 From: Tigrov Date: Tue, 30 Jan 2024 15:41:19 +0700 Subject: [PATCH 2/4] Add line to CHANGELOG.md [skip ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e15aba8..7e0b36a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Enh #286: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov) - Bug #287: Fix `DMLQueryBuilder::insertWithReturningPks()` and `Command::insertWithReturningPks()` methods (@Tigrov) +- Enh #291: Resolve deprecated methods (@Tigrov) ## 1.1.0 November 12, 2023 From fd6c7dd88e1257700b831eb717dc1587617e5de9 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Thu, 1 Feb 2024 18:12:12 +0700 Subject: [PATCH 3/4] Fix test --- tests/SchemaTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 150771f84becb4ad0f477c162c3faf35851deaaa Mon Sep 17 00:00:00 2001 From: Sergei Tigrov Date: Mon, 5 Feb 2024 01:21:58 +0700 Subject: [PATCH 4/4] Fix psalm issues --- src/Schema.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Schema.php b/src/Schema.php index a2ec3031..109fb07a 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -902,10 +902,12 @@ 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 { - return array_merge([self::class], $this->generateCacheKey(), [$this->db->getQuoter()->getRawTableName($name)]); + return array_merge([self::class], $this->generateCacheKey(), [$this->getRawTableName($name)]); } /**