Skip to content

Commit 5854fb7

Browse files
authored
Merge branch 'master' into refactor-getDataType
2 parents dbb35ec + f655cb7 commit 5854fb7

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- Enh #779: Specify populate closure type in `BatchQueryResultInterface` (@vjik)
1010
- Enh #778: Deprecate unnecessary argument `$rawSql` of `AbstractCommand::internalExecute()` (@Tigrov)
1111
- Enh #786: Refactor `AbstractSchema::getDataType()` (@Tigrov)
12+
- Enh #784: Specify result type of `ConstraintSchemaInterface::getTableIndexes()` method to `IndexConstraint[]` (@vjik)
13+
- Enh #784: Remove unused code in `AbstractSchema::getTableIndexes()` (@vjik)
1214

1315
## 1.2.0 November 12, 2023
1416

src/Constraint/ConstraintSchemaInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function getTableForeignKeys(string $name, bool $refresh = false): array;
131131
* @param string $name Table name. The table name may contain a schema name if any. Don't quote the table name.
132132
* @param bool $refresh Whether to reload the information, even if it's found in the cache.
133133
*
134-
* @return array The information metadata for the indexes of the named table.
134+
* @return IndexConstraint[] The information metadata for the indexes of the named table.
135135
*/
136136
public function getTableIndexes(string $name, bool $refresh = false): array;
137137

src/QueryBuilder/AbstractDMLQueryBuilder.php

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use JsonException;
88
use Yiisoft\Db\Constraint\Constraint;
9-
use Yiisoft\Db\Constraint\IndexConstraint;
109
use Yiisoft\Db\Exception\Exception;
1110
use Yiisoft\Db\Exception\InvalidArgumentException;
1211
use Yiisoft\Db\Exception\InvalidConfigException;
@@ -335,7 +334,6 @@ private function getTableUniqueColumnNames(string $name, array $columns, array &
335334
$constraints[] = $primaryKey;
336335
}
337336

338-
/** @psalm-var IndexConstraint[] $tableIndexes */
339337
$tableIndexes = $this->schema->getTableIndexes($name);
340338

341339
foreach ($tableIndexes as $constraint) {

src/Schema/AbstractSchema.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Yiisoft\Db\Command\DataType;
1111
use Yiisoft\Db\Connection\ConnectionInterface;
1212
use Yiisoft\Db\Constraint\Constraint;
13+
use Yiisoft\Db\Constraint\IndexConstraint;
1314
use Yiisoft\Db\Exception\NotSupportedException;
1415

1516
use function array_change_key_case;
@@ -95,7 +96,7 @@ abstract protected function loadTableForeignKeys(string $tableName): array;
9596
*
9697
* @param string $tableName The table name.
9798
*
98-
* @return array The indexes for the given table.
99+
* @return IndexConstraint[] The indexes for the given table.
99100
*/
100101
abstract protected function loadTableIndexes(string $tableName): array;
101102

@@ -256,9 +257,8 @@ public function getTableForeignKeys(string $name, bool $refresh = false): array
256257
*/
257258
public function getTableIndexes(string $name, bool $refresh = false): array
258259
{
259-
/** @psalm-var mixed $tableIndexes */
260-
$tableIndexes = $this->getTableMetadata($name, SchemaInterface::INDEXES, $refresh);
261-
return is_array($tableIndexes) ? $tableIndexes : [];
260+
/** @var IndexConstraint[] */
261+
return $this->getTableMetadata($name, SchemaInterface::INDEXES, $refresh);
262262
}
263263

264264
/**

0 commit comments

Comments
 (0)