@@ -89,8 +89,8 @@ protected function _insertBatch(string $table, array $keys, array $values): stri
89
89
$ data = implode (
90
90
" FROM DUAL UNION ALL \n" ,
91
91
array_map (
92
- static fn ($ value ) => 'SELECT ' . implode (', ' , array_map (
93
- static fn ($ key , $ index ) => $ index . ' ' . $ key ,
92
+ static fn ($ value ): string => 'SELECT ' . implode (', ' , array_map (
93
+ static fn ($ key , $ index ): string => $ index . ' ' . $ key ,
94
94
$ keys ,
95
95
$ value
96
96
)),
@@ -107,7 +107,7 @@ protected function _insertBatch(string $table, array $keys, array $values): stri
107
107
*/
108
108
protected function _replace (string $ table , array $ keys , array $ values ): string
109
109
{
110
- $ fieldNames = array_map (static fn ($ columnName ) => trim ($ columnName , '" ' ), $ keys );
110
+ $ fieldNames = array_map (static fn ($ columnName ): string => trim ($ columnName , '" ' ), $ keys );
111
111
112
112
$ uniqueIndexes = array_filter ($ this ->db ->getIndexData ($ table ), static function ($ index ) use ($ fieldNames ): bool {
113
113
$ hasAllFields = count (array_intersect ($ index ->fields , $ fieldNames )) === count ($ index ->fields );
@@ -126,24 +126,24 @@ protected function _replace(string $table, array $keys, array $values): string
126
126
127
127
$ sql = 'MERGE INTO ' . $ table . "\n USING (SELECT " ;
128
128
129
- $ sql .= implode (', ' , array_map (static fn ($ columnName , $ value ) => $ value . ' ' . $ columnName , $ keys , $ values ));
129
+ $ sql .= implode (', ' , array_map (static fn ($ columnName , $ value ): string => $ value . ' ' . $ columnName , $ keys , $ values ));
130
130
131
131
$ sql .= ' FROM DUAL) "_replace" ON ( ' ;
132
132
133
133
$ onList = [];
134
134
$ onList [] = '1 != 1 ' ;
135
135
136
136
foreach ($ uniqueIndexes as $ index ) {
137
- $ onList [] = '( ' . implode (' AND ' , array_map (static fn ($ columnName ) => $ table . '." ' . $ columnName . '" = "_replace"." ' . $ columnName . '" ' , $ index ->fields )) . ') ' ;
137
+ $ onList [] = '( ' . implode (' AND ' , array_map (static fn ($ columnName ): string => $ table . '." ' . $ columnName . '" = "_replace"." ' . $ columnName . '" ' , $ index ->fields )) . ') ' ;
138
138
}
139
139
140
140
$ sql .= implode (' OR ' , $ onList ) . ') WHEN MATCHED THEN UPDATE SET ' ;
141
141
142
- $ sql .= implode (', ' , array_map (static fn ($ columnName ) => $ columnName . ' = "_replace". ' . $ columnName , $ replaceableFields ));
142
+ $ sql .= implode (', ' , array_map (static fn ($ columnName ): string => $ columnName . ' = "_replace". ' . $ columnName , $ replaceableFields ));
143
143
144
144
$ sql .= ' WHEN NOT MATCHED THEN INSERT ( ' . implode (', ' , $ replaceableFields ) . ') VALUES ' ;
145
145
146
- return $ sql . (' ( ' . implode (', ' , array_map (static fn ($ columnName ) => '"_replace". ' . $ columnName , $ replaceableFields )) . ') ' );
146
+ return $ sql . (' ( ' . implode (', ' , array_map (static fn ($ columnName ): string => '"_replace". ' . $ columnName , $ replaceableFields )) . ') ' );
147
147
}
148
148
149
149
/**
@@ -298,7 +298,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
298
298
$ sql .= implode (
299
299
", \n" ,
300
300
array_map (
301
- static fn ($ key , $ value ) => $ table . '. ' . $ key . ($ value instanceof RawSql ?
301
+ static fn ($ key , $ value ): string => $ table . '. ' . $ key . ($ value instanceof RawSql ?
302
302
' = ' . $ value :
303
303
' = ' . $ alias . '. ' . $ value ),
304
304
array_keys ($ updateFields ),
@@ -315,8 +315,8 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
315
315
$ data = implode (
316
316
" UNION ALL \n" ,
317
317
array_map (
318
- static fn ($ value ) => 'SELECT ' . implode (', ' , array_map (
319
- static fn ($ key , $ index ) => $ index . ' ' . $ key ,
318
+ static fn ($ value ): string => 'SELECT ' . implode (', ' , array_map (
319
+ static fn ($ key , $ index ): string => $ index . ' ' . $ key ,
320
320
$ keys ,
321
321
$ value
322
322
)) . ' FROM DUAL ' ,
@@ -342,7 +342,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
342
342
$ constraints = $ this ->QBOptions ['constraints ' ] ?? [];
343
343
344
344
if (empty ($ constraints )) {
345
- $ fieldNames = array_map (static fn ($ columnName ) => trim ($ columnName , '" ' ), $ keys );
345
+ $ fieldNames = array_map (static fn ($ columnName ): string => trim ($ columnName , '" ' ), $ keys );
346
346
347
347
$ uniqueIndexes = array_filter ($ this ->db ->getIndexData ($ table ), static function ($ index ) use ($ fieldNames ): bool {
348
348
$ hasAllFields = count (array_intersect ($ index ->fields , $ fieldNames )) === count ($ index ->fields );
@@ -401,7 +401,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
401
401
$ sql .= implode (
402
402
", \n" ,
403
403
array_map (
404
- static fn ($ key , $ value ) => $ key . ($ value instanceof RawSql ?
404
+ static fn ($ key , $ value ): string => $ key . ($ value instanceof RawSql ?
405
405
" = {$ value }" :
406
406
" = {$ alias }. {$ value }" ),
407
407
array_keys ($ updateFields ),
@@ -412,7 +412,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
412
412
$ sql .= "\nWHEN NOT MATCHED THEN INSERT ( " . implode (', ' , $ keys ) . ") \nVALUES " ;
413
413
414
414
$ sql .= (' ( '
415
- . implode (', ' , array_map (static fn ($ columnName ) => "{$ alias }. {$ columnName }" , $ keys ))
415
+ . implode (', ' , array_map (static fn ($ columnName ): string => "{$ alias }. {$ columnName }" , $ keys ))
416
416
. ') ' );
417
417
418
418
$ this ->QBOptions ['sql ' ] = $ sql ;
@@ -424,8 +424,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
424
424
$ data = implode (
425
425
" FROM DUAL UNION ALL \n" ,
426
426
array_map (
427
- static fn ($ value ) => 'SELECT ' . implode (', ' , array_map (
428
- static fn ($ key , $ index ) => $ index . ' ' . $ key ,
427
+ static fn ($ value ): string => 'SELECT ' . implode (', ' , array_map (
428
+ static fn ($ key , $ index ): string => $ index . ' ' . $ key ,
429
429
$ keys ,
430
430
$ value
431
431
)),
@@ -503,8 +503,8 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri
503
503
$ data = implode (
504
504
" FROM DUAL UNION ALL \n" ,
505
505
array_map (
506
- static fn ($ value ) => 'SELECT ' . implode (', ' , array_map (
507
- static fn ($ key , $ index ) => $ index . ' ' . $ key ,
506
+ static fn ($ value ): string => 'SELECT ' . implode (', ' , array_map (
507
+ static fn ($ key , $ index ): string => $ index . ' ' . $ key ,
508
508
$ keys ,
509
509
$ value
510
510
)),
0 commit comments