diff --git a/CHANGELOG.md b/CHANGELOG.md index b70aa665..f501b57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Enh #251: Allow to use `DMLQueryBuilderInterface::batchInsert()` method with empty columns (@Tigrov) - Bug #238: Fix execution `Query` without table(s) to select from (@Tigrov) - Bug #254: Fix, table sequence name should be null if sequence name not found (@Tigrov) +- Enh #253: Resolve deprecated methods (@Tigrov) ## 1.2.0 November 12, 2023 diff --git a/src/Schema.php b/src/Schema.php index fa929a29..14b9664d 100644 --- a/src/Schema.php +++ b/src/Schema.php @@ -21,6 +21,8 @@ use Yiisoft\Db\Schema\ColumnSchemaInterface; use Yiisoft\Db\Schema\TableSchemaInterface; +use function array_change_key_case; +use function array_map; use function array_merge; use function array_reverse; use function implode; @@ -208,7 +210,7 @@ protected function findTableNames(string $schema = ''): array /** @psalm-var string[][] $rows */ foreach ($rows as $row) { /** @psalm-var string[] $row */ - $row = $this->normalizeRowKeyCase($row, false); + $row = array_change_key_case($row); $names[] = $row['table_name']; } @@ -287,7 +289,7 @@ protected function loadTableIndexes(string $tableName): array ])->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 = []; @@ -406,7 +408,7 @@ protected function findColumns(TableSchemaInterface $table): bool /** @psalm-var string[][] $columns */ foreach ($columns as $column) { /** @psalm-var ColumnInfoArray $column */ - $column = $this->normalizeRowKeyCase($column, false); + $column = array_change_key_case($column); $c = $this->createColumnSchema($column); @@ -554,7 +556,7 @@ protected function findConstraints(TableSchemaInterface $table): void foreach ($rows as $row) { /** @psalm-var string[] $row */ - $row = $this->normalizeRowKeyCase($row, false); + $row = array_change_key_case($row); if ($row['constraint_type'] === 'P') { $table->getColumns()[$row['column_name']]->primaryKey(true); @@ -715,7 +717,7 @@ private function loadTableConstraints(string $tableName, string $returnType): mi ])->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 = [ @@ -805,6 +807,8 @@ protected function findViewNames(string $schema = ''): array * @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 b29ef247..2fb6f0fe 100644 --- a/tests/SchemaTest.php +++ b/tests/SchemaTest.php @@ -293,6 +293,6 @@ public function testNotConnectionPDO(): void $this->expectException(NotSupportedException::class); $this->expectExceptionMessage('Only PDO connections are supported.'); - $schema->refreshTableSchema('customer'); + $schema->refresh(); } }