@@ -1562,13 +1562,13 @@ discard block |
||
1562 | 1562 | return [ |
1563 | 1563 | 'drop' => [ |
1564 | 1564 | "ALTER TABLE {{{$tableName}}} DROP CONSTRAINT [[$name]]", |
1565 | - static function (QueryBuilder $qb) use ($tableName, $name) { |
|
1565 | + static function(QueryBuilder $qb) use ($tableName, $name) { |
|
1566 | 1566 | return $qb->dropCheck($name, $tableName); |
1567 | 1567 | }, |
1568 | 1568 | ], |
1569 | 1569 | 'add' => [ |
1570 | 1570 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] CHECK ([[C_not_null]] > 100)", |
1571 | - static function (QueryBuilder $qb) use ($tableName, $name) { |
|
1571 | + static function(QueryBuilder $qb) use ($tableName, $name) { |
|
1572 | 1572 | return $qb->addCheck($name, $tableName, '[[C_not_null]] > 100'); |
1573 | 1573 | }, |
1574 | 1574 | ], |
@@ -1584,14 +1584,14 @@ discard block |
||
1584 | 1584 | return [ |
1585 | 1585 | 'drop' => [ |
1586 | 1586 | "ALTER TABLE {{{$tableName}}} DROP CONSTRAINT [[$name]]", |
1587 | - static function (QueryBuilder $qb) use ($tableName, $name) { |
|
1587 | + static function(QueryBuilder $qb) use ($tableName, $name) { |
|
1588 | 1588 | return $qb->dropForeignKey($name, $tableName); |
1589 | 1589 | }, |
1590 | 1590 | ], |
1591 | 1591 | 'add' => [ |
1592 | 1592 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] FOREIGN KEY ([[C_fk_id_1]])" |
1593 | 1593 | . " REFERENCES {{{$pkTableName}}} ([[C_id_1]]) ON DELETE CASCADE ON UPDATE CASCADE", |
1594 | - static function (QueryBuilder $qb) use ($tableName, $name, $pkTableName) { |
|
1594 | + static function(QueryBuilder $qb) use ($tableName, $name, $pkTableName) { |
|
1595 | 1595 | return $qb->addForeignKey( |
1596 | 1596 | $name, |
1597 | 1597 | $tableName, |
@@ -1606,7 +1606,7 @@ discard block |
||
1606 | 1606 | 'add (2 columns)' => [ |
1607 | 1607 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] FOREIGN KEY ([[C_fk_id_1]], [[C_fk_id_2]])" |
1608 | 1608 | . " REFERENCES {{{$pkTableName}}} ([[C_id_1]], [[C_id_2]]) ON DELETE CASCADE ON UPDATE CASCADE", |
1609 | - static function (QueryBuilder $qb) use ($tableName, $name, $pkTableName) { |
|
1609 | + static function(QueryBuilder $qb) use ($tableName, $name, $pkTableName) { |
|
1610 | 1610 | return $qb->addForeignKey( |
1611 | 1611 | $name, |
1612 | 1612 | $tableName, |
@@ -1629,19 +1629,19 @@ discard block |
||
1629 | 1629 | return [ |
1630 | 1630 | 'drop' => [ |
1631 | 1631 | "ALTER TABLE {{{$tableName}}} DROP CONSTRAINT [[$name]]", |
1632 | - static function (QueryBuilder $qb) use ($tableName, $name) { |
|
1632 | + static function(QueryBuilder $qb) use ($tableName, $name) { |
|
1633 | 1633 | return $qb->dropPrimaryKey($name, $tableName); |
1634 | 1634 | }, |
1635 | 1635 | ], |
1636 | 1636 | 'add' => [ |
1637 | 1637 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] PRIMARY KEY ([[C_id_1]])", |
1638 | - static function (QueryBuilder $qb) use ($tableName, $name) { |
|
1638 | + static function(QueryBuilder $qb) use ($tableName, $name) { |
|
1639 | 1639 | return $qb->addPrimaryKey($name, $tableName, 'C_id_1'); |
1640 | 1640 | }, |
1641 | 1641 | ], |
1642 | 1642 | 'add (2 columns)' => [ |
1643 | 1643 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] PRIMARY KEY ([[C_id_1]], [[C_id_2]])", |
1644 | - static function (QueryBuilder $qb) use ($tableName, $name) { |
|
1644 | + static function(QueryBuilder $qb) use ($tableName, $name) { |
|
1645 | 1645 | return $qb->addPrimaryKey($name, $tableName, 'C_id_1, C_id_2'); |
1646 | 1646 | }, |
1647 | 1647 | ], |
@@ -1658,19 +1658,19 @@ discard block |
||
1658 | 1658 | return [ |
1659 | 1659 | 'drop' => [ |
1660 | 1660 | "ALTER TABLE {{{$tableName1}}} DROP CONSTRAINT [[$name1]]", |
1661 | - static function (QueryBuilder $qb) use ($tableName1, $name1) { |
|
1661 | + static function(QueryBuilder $qb) use ($tableName1, $name1) { |
|
1662 | 1662 | return $qb->dropUnique($name1, $tableName1); |
1663 | 1663 | }, |
1664 | 1664 | ], |
1665 | 1665 | 'add' => [ |
1666 | 1666 | "ALTER TABLE {{{$tableName1}}} ADD CONSTRAINT [[$name1]] UNIQUE ([[C_unique]])", |
1667 | - static function (QueryBuilder $qb) use ($tableName1, $name1) { |
|
1667 | + static function(QueryBuilder $qb) use ($tableName1, $name1) { |
|
1668 | 1668 | return $qb->addUnique($name1, $tableName1, 'C_unique'); |
1669 | 1669 | }, |
1670 | 1670 | ], |
1671 | 1671 | 'add (2 columns)' => [ |
1672 | 1672 | "ALTER TABLE {{{$tableName2}}} ADD CONSTRAINT [[$name2]] UNIQUE ([[C_index_2_1]], [[C_index_2_2]])", |
1673 | - static function (QueryBuilder $qb) use ($tableName2, $name2) { |
|
1673 | + static function(QueryBuilder $qb) use ($tableName2, $name2) { |
|
1674 | 1674 | return $qb->addUnique($name2, $tableName2, 'C_index_2_1, C_index_2_2'); |
1675 | 1675 | }, |
1676 | 1676 | ], |
@@ -2348,31 +2348,31 @@ discard block |
||
2348 | 2348 | return [ |
2349 | 2349 | 'drop' => [ |
2350 | 2350 | "DROP INDEX [[$name1]] ON {{{$tableName}}}", |
2351 | - static function (QueryBuilder $qb) use ($tableName, $name1) { |
|
2351 | + static function(QueryBuilder $qb) use ($tableName, $name1) { |
|
2352 | 2352 | return $qb->dropIndex($name1, $tableName); |
2353 | 2353 | }, |
2354 | 2354 | ], |
2355 | 2355 | 'create' => [ |
2356 | 2356 | "CREATE INDEX [[$name1]] ON {{{$tableName}}} ([[C_index_1]])", |
2357 | - static function (QueryBuilder $qb) use ($tableName, $name1) { |
|
2357 | + static function(QueryBuilder $qb) use ($tableName, $name1) { |
|
2358 | 2358 | return $qb->createIndex($name1, $tableName, 'C_index_1'); |
2359 | 2359 | }, |
2360 | 2360 | ], |
2361 | 2361 | 'create (2 columns)' => [ |
2362 | 2362 | "CREATE INDEX [[$name2]] ON {{{$tableName}}} ([[C_index_2_1]], [[C_index_2_2]])", |
2363 | - static function (QueryBuilder $qb) use ($tableName, $name2) { |
|
2363 | + static function(QueryBuilder $qb) use ($tableName, $name2) { |
|
2364 | 2364 | return $qb->createIndex($name2, $tableName, 'C_index_2_1, C_index_2_2'); |
2365 | 2365 | }, |
2366 | 2366 | ], |
2367 | 2367 | 'create unique' => [ |
2368 | 2368 | "CREATE UNIQUE INDEX [[$name1]] ON {{{$tableName}}} ([[C_index_1]])", |
2369 | - static function (QueryBuilder $qb) use ($tableName, $name1) { |
|
2369 | + static function(QueryBuilder $qb) use ($tableName, $name1) { |
|
2370 | 2370 | return $qb->createIndex($name1, $tableName, 'C_index_1', true); |
2371 | 2371 | }, |
2372 | 2372 | ], |
2373 | 2373 | 'create unique (2 columns)' => [ |
2374 | 2374 | "CREATE UNIQUE INDEX [[$name2]] ON {{{$tableName}}} ([[C_index_2_1]], [[C_index_2_2]])", |
2375 | - static function (QueryBuilder $qb) use ($tableName, $name2) { |
|
2375 | + static function(QueryBuilder $qb) use ($tableName, $name2) { |
|
2376 | 2376 | return $qb->createIndex($name2, $tableName, 'C_index_2_1, C_index_2_2', true); |
2377 | 2377 | }, |
2378 | 2378 | ], |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | public function toString(): string |
32 | 32 | { |
33 | - $allowedValues = array_map(static function ($value) { |
|
33 | + $allowedValues = array_map(static function($value) { |
|
34 | 34 | return VarDumper::create($value)->asString(); |
35 | 35 | }, $this->allowedValues); |
36 | 36 |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | /** Remove duplicates */ |
647 | 647 | $constraints = array_combine( |
648 | 648 | array_map( |
649 | - static function ($constraint) { |
|
649 | + static function($constraint) { |
|
650 | 650 | $columns = $constraint->getColumnNames(); |
651 | 651 | sort($columns, SORT_STRING); |
652 | 652 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | $constraints = array_values( |
664 | 664 | array_filter( |
665 | 665 | $constraints, |
666 | - static function ($constraint) use ($schema, $columns, &$columnNames) { |
|
666 | + static function($constraint) use ($schema, $columns, &$columnNames) { |
|
667 | 667 | /** @psalm-suppress UndefinedClass, UndefinedMethod */ |
668 | 668 | $constraintColumnNames = array_map([$schema, 'quoteColumnName'], $constraint->getColumnNames()); |
669 | 669 | $result = !array_diff($constraintColumnNames, $columns); |
@@ -1746,7 +1746,7 @@ discard block |
||
1746 | 1746 | */ |
1747 | 1747 | protected function hasOffset($offset): bool |
1748 | 1748 | { |
1749 | - return ($offset instanceof ExpressionInterface) || (ctype_digit((string)$offset) && (string)$offset !== '0'); |
|
1749 | + return ($offset instanceof ExpressionInterface) || (ctype_digit((string) $offset) && (string) $offset !== '0'); |
|
1750 | 1750 | } |
1751 | 1751 | |
1752 | 1752 | /** |
@@ -73,7 +73,7 @@ |
||
73 | 73 | { |
74 | 74 | return preg_replace_callback( |
75 | 75 | '/({{(%?[\w\-. ]+%?)}}|\\[\\[([\w\-. ]+)]])/', |
76 | - function ($matches) { |
|
76 | + function($matches) { |
|
77 | 77 | if (isset($matches[3])) { |
78 | 78 | return $this->quoteColumnName($matches[3]); |
79 | 79 | } |
@@ -813,7 +813,7 @@ |
||
813 | 813 | } |
814 | 814 | |
815 | 815 | if ($multiple) { |
816 | - return array_map(static function (array $row) { |
|
816 | + return array_map(static function(array $row) { |
|
817 | 817 | return array_change_key_case($row, CASE_LOWER); |
818 | 818 | }, $row); |
819 | 819 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->expectException(Exception::class); |
115 | 115 | |
116 | - $db->transaction(function () use ($db) { |
|
116 | + $db->transaction(function() use ($db) { |
|
117 | 117 | $db |
118 | 118 | ->createCommand() |
119 | 119 | ->insert('profile', ['description' => 'test transaction shortcut']) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $db = $this->getConnection(true); |
134 | 134 | |
135 | - $result = $db->transaction(static function () use ($db) { |
|
135 | + $result = $db->transaction(static function() use ($db) { |
|
136 | 136 | $db |
137 | 137 | ->createCommand() |
138 | 138 | ->insert('profile', ['description' => 'test transaction shortcut']) |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $db = $this->getConnection(true); |
157 | 157 | |
158 | - $result = $db->transaction(static function (ConnectionInterface $db) { |
|
158 | + $result = $db->transaction(static function(ConnectionInterface $db) { |
|
159 | 159 | $db |
160 | 160 | ->createCommand() |
161 | 161 | ->insert('profile', ['description' => 'test transaction shortcut']) |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | { |
184 | 184 | $db = $this->getConnection(); |
185 | 185 | |
186 | - $db->transaction(function (ConnectionInterface $db) { |
|
186 | + $db->transaction(function(ConnectionInterface $db) { |
|
187 | 187 | $this->assertNotNull($db->getTransaction()); |
188 | 188 | |
189 | - $db->transaction(function (ConnectionInterface $db) { |
|
189 | + $db->transaction(function(ConnectionInterface $db) { |
|
190 | 190 | $this->assertNotNull($db->getTransaction()); |
191 | 191 | $db |
192 | 192 | ->getTransaction() |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | $db->setEnableSavepoint(false); |
205 | 205 | |
206 | - $db->transaction(function (ConnectionInterface $db) { |
|
206 | + $db->transaction(function(ConnectionInterface $db) { |
|
207 | 207 | $this->assertNotNull($db->getTransaction()); |
208 | 208 | $this->expectException(NotSupportedException::class); |
209 | 209 | $db->beginTransaction(); |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | ->from('customer') |
574 | 574 | ->select(['name', 'id']) |
575 | 575 | ->orderBy(['id' => SORT_DESC]) |
576 | - ->indexBy(function ($row) { |
|
576 | + ->indexBy(function($row) { |
|
577 | 577 | return $row['id'] * 2; |
578 | 578 | }) |
579 | 579 | ->column(); |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | ); |
907 | 907 | |
908 | 908 | /* Connection cache */ |
909 | - $db->cache(function (ConnectionInterface $db) use ($query, $update) { |
|
909 | + $db->cache(function(ConnectionInterface $db) use ($query, $update) { |
|
910 | 910 | $this->assertEquals( |
911 | 911 | 'user2', |
912 | 912 | $query |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | 'Query does NOT reflect DB changes when wrapped in connection caching' |
928 | 928 | ); |
929 | 929 | |
930 | - $db->noCache(function () use ($query) { |
|
930 | + $db->noCache(function() use ($query) { |
|
931 | 931 | $this->assertEquals( |
932 | 932 | 'user22', |
933 | 933 | $query |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | |
949 | 949 | $this->queryCache->setEnable(false); |
950 | 950 | |
951 | - $db->cache(function () use ($query, $update) { |
|
951 | + $db->cache(function() use ($query, $update) { |
|
952 | 952 | $this->assertEquals( |
953 | 953 | 'user22', |
954 | 954 | $query |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | 'When Query has disabled cache, we get actual data' |
995 | 995 | ); |
996 | 996 | |
997 | - $db->cache(function () use ($query) { |
|
997 | + $db->cache(function() use ($query) { |
|
998 | 998 | $this->assertEquals('user1', $query |
999 | 999 | ->noCache() |
1000 | 1000 | ->where(['id' => 1]) |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | public function testBatchInsertWithYield(): void |
267 | 267 | { |
268 | - $rows = (static function () { |
|
268 | + $rows = (static function() { |
|
269 | 269 | if (false) { |
270 | 270 | yield []; |
271 | 271 | } |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | ->queryScalar(), |
1101 | 1101 | ); |
1102 | 1102 | |
1103 | - $db->cache(function (ConnectionInterface $db) use ($command, $update) { |
|
1103 | + $db->cache(function(ConnectionInterface $db) use ($command, $update) { |
|
1104 | 1104 | $this->assertEquals( |
1105 | 1105 | 'user2', |
1106 | 1106 | $command |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | ->queryScalar(), |
1120 | 1120 | ); |
1121 | 1121 | |
1122 | - $db->noCache(function () use ($command) { |
|
1122 | + $db->noCache(function() use ($command) { |
|
1123 | 1123 | $this->assertEquals( |
1124 | 1124 | 'user22', |
1125 | 1125 | $command |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | |
1139 | 1139 | $this->queryCache->setEnable(false); |
1140 | 1140 | |
1141 | - $db->cache(function () use ($command, $update) { |
|
1141 | + $db->cache(function() use ($command, $update) { |
|
1142 | 1142 | $this->assertEquals( |
1143 | 1143 | 'user22', |
1144 | 1144 | $command |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | |
1190 | 1190 | $command = $db->createCommand('SELECT [[name]] FROM {{customer}} WHERE [[id]] = :id'); |
1191 | 1191 | |
1192 | - $db->cache(function () use ($command) { |
|
1192 | + $db->cache(function() use ($command) { |
|
1193 | 1193 | $this->assertEquals( |
1194 | 1194 | 'user11', |
1195 | 1195 | $command |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | $this->invokeMethod( |
1304 | 1304 | $command, |
1305 | 1305 | 'setRetryHandler', |
1306 | - [static function ($exception, $attempt) use (&$attempts, &$hitHandler) { |
|
1306 | + [static function($exception, $attempt) use (&$attempts, &$hitHandler) { |
|
1307 | 1307 | $attempts = $attempt; |
1308 | 1308 | $hitHandler = true; |
1309 | 1309 |