21
21
use Yiisoft \Db \Schema \TableSchemaInterface ;
22
22
23
23
use function array_column ;
24
+ use function array_map ;
24
25
use function array_merge ;
25
26
use function count ;
26
27
use function explode ;
@@ -201,7 +202,7 @@ protected function loadTableForeignKeys(string $tableName): array
201
202
202
203
$ foreignKeysList = $ this ->getPragmaForeignKeyList ($ tableName );
203
204
/** @psalm-var ForeignKeyInfo[] $foreignKeysList */
204
- $ foreignKeysList = $ this -> normalizeRowKeyCase ( $ foreignKeysList , true );
205
+ $ foreignKeysList = array_map ( ' array_change_key_case ' , $ foreignKeysList );
205
206
$ foreignKeysList = DbArrayHelper::index ($ foreignKeysList , null , ['table ' ]);
206
207
DbArrayHelper::multisort ($ foreignKeysList , 'seq ' );
207
208
@@ -553,7 +554,7 @@ private function loadTableColumnsInfo(string $tableName): array
553
554
{
554
555
$ tableColumns = $ this ->getPragmaTableInfo ($ tableName );
555
556
/** @psalm-var ColumnInfo[] $tableColumns */
556
- $ tableColumns = $ this -> normalizeRowKeyCase ( $ tableColumns , true );
557
+ $ tableColumns = array_map ( ' array_change_key_case ' , $ tableColumns );
557
558
558
559
/** @psalm-var ColumnInfo[] */
559
560
return DbArrayHelper::index ($ tableColumns , 'cid ' );
@@ -575,7 +576,7 @@ private function loadTableConstraints(string $tableName, string $returnType): Co
575
576
{
576
577
$ indexList = $ this ->getPragmaIndexList ($ tableName );
577
578
/** @psalm-var IndexListInfo[] $indexes */
578
- $ indexes = $ this -> normalizeRowKeyCase ( $ indexList , true );
579
+ $ indexes = array_map ( ' array_change_key_case ' , $ indexList );
579
580
$ result = [
580
581
self ::PRIMARY_KEY => null ,
581
582
self ::INDEXES => [],
@@ -642,9 +643,12 @@ private function createColumnSchema(string $name): ColumnSchemaInterface
642
643
* @throws Exception
643
644
* @throws InvalidConfigException
644
645
* @throws Throwable
646
+ *
647
+ * @psalm-return ForeignKeyInfo[]
645
648
*/
646
649
private function getPragmaForeignKeyList (string $ tableName ): array
647
650
{
651
+ /** @psalm-var ForeignKeyInfo[] */
648
652
return $ this ->db ->createCommand (
649
653
'PRAGMA FOREIGN_KEY_LIST( ' . $ this ->db ->getQuoter ()->quoteSimpleTableName ($ tableName ) . ') '
650
654
)->queryAll ();
@@ -662,7 +666,7 @@ private function getPragmaIndexInfo(string $name): array
662
666
$ column = $ this ->db
663
667
->createCommand ('PRAGMA INDEX_INFO( ' . (string ) $ this ->db ->getQuoter ()->quoteValue ($ name ) . ') ' )
664
668
->queryAll ();
665
- $ column = $ this -> normalizeRowKeyCase ( $ column , true );
669
+ $ column = array_map ( ' array_change_key_case ' , $ column );
666
670
DbArrayHelper::multisort ($ column , 'seqno ' );
667
671
668
672
/** @psalm-var IndexInfo[] $column */
@@ -673,9 +677,12 @@ private function getPragmaIndexInfo(string $name): array
673
677
* @throws Exception
674
678
* @throws InvalidConfigException
675
679
* @throws Throwable
680
+ *
681
+ * @psalm-return IndexListInfo[]
676
682
*/
677
683
private function getPragmaIndexList (string $ tableName ): array
678
684
{
685
+ /** @psalm-var IndexListInfo[] */
679
686
return $ this ->db
680
687
->createCommand ('PRAGMA INDEX_LIST( ' . (string ) $ this ->db ->getQuoter ()->quoteValue ($ tableName ) . ') ' )
681
688
->queryAll ();
@@ -723,6 +730,8 @@ protected function findViewNames(string $schema = ''): array
723
730
* @param string $name the table name.
724
731
*
725
732
* @return array The cache key.
733
+ *
734
+ * @psalm-suppress DeprecatedMethod
726
735
*/
727
736
protected function getCacheKey (string $ name ): array
728
737
{
0 commit comments