From ccef4fd323bc08a013df1190f6465a44f62f4906 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Sun, 5 May 2024 09:16:50 +0700 Subject: [PATCH] Fix psalm --- src/DMLQueryBuilder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DMLQueryBuilder.php b/src/DMLQueryBuilder.php index c1b57e1..bcb5873 100644 --- a/src/DMLQueryBuilder.php +++ b/src/DMLQueryBuilder.php @@ -13,6 +13,7 @@ use Yiisoft\Db\Query\QueryInterface; use Yiisoft\Db\QueryBuilder\AbstractDMLQueryBuilder; +use function array_key_first; use function array_map; use function implode; use function count; @@ -164,7 +165,8 @@ protected function prepareInsertValues(string $table, array|QueryInterface $colu if (!empty($tableSchema->getPrimaryKey())) { $columns = $tableSchema->getPrimaryKey(); } else { - $columns = [current($tableSchema->getColumns())->getName()]; + /** @var list $columns */ + $columns = [array_key_first($tableSchema->getColumns())]; } foreach ($columns as $name) {