@@ -1136,20 +1136,20 @@ |
||
1136 | 1136 | $secondQuery = new Query($db); |
1137 | 1137 | |
1138 | 1138 | $secondQuery->select('id') |
1139 | - ->from('TotalTotalExample t2') |
|
1140 | - ->where('w > 5'); |
|
1139 | + ->from('TotalTotalExample t2') |
|
1140 | + ->where('w > 5'); |
|
1141 | 1141 | |
1142 | 1142 | $thirdQuery = new Query($db); |
1143 | 1143 | |
1144 | 1144 | $thirdQuery->select('id') |
1145 | - ->from('TotalTotalExample t3') |
|
1146 | - ->where('w = 3'); |
|
1145 | + ->from('TotalTotalExample t3') |
|
1146 | + ->where('w = 3'); |
|
1147 | 1147 | |
1148 | 1148 | $query->select('id') |
1149 | - ->from('TotalExample t1') |
|
1150 | - ->where(['and', 'w > 0', 'x < 2']) |
|
1151 | - ->union($secondQuery) |
|
1152 | - ->union($thirdQuery, true); |
|
1149 | + ->from('TotalExample t1') |
|
1150 | + ->where(['and', 'w > 0', 'x < 2']) |
|
1151 | + ->union($secondQuery) |
|
1152 | + ->union($thirdQuery, true); |
|
1153 | 1153 | |
1154 | 1154 | [$actualQuerySql, $queryParams] = $db->getQueryBuilder()->build($query); |
1155 | 1155 |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $result = (new Query($db))->from('customer') |
551 | 551 | ->select(['name', 'id']) |
552 | 552 | ->orderBy(['id' => SORT_DESC]) |
553 | - ->indexBy(function ($row) { |
|
553 | + ->indexBy(function($row) { |
|
554 | 554 | return $row['id'] * 2; |
555 | 555 | }) |
556 | 556 | ->column(); |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | ); |
815 | 815 | |
816 | 816 | /* Connection cache */ |
817 | - $db->cache(function (ConnectionInterface $db) use ($query, $update) { |
|
817 | + $db->cache(function(ConnectionInterface $db) use ($query, $update) { |
|
818 | 818 | $this->assertEquals( |
819 | 819 | 'user2', |
820 | 820 | $query->where(['id' => 2])->scalar(), |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | 'Query does NOT reflect DB changes when wrapped in connection caching' |
830 | 830 | ); |
831 | 831 | |
832 | - $db->noCache(function () use ($query) { |
|
832 | + $db->noCache(function() use ($query) { |
|
833 | 833 | $this->assertEquals( |
834 | 834 | 'user22', |
835 | 835 | $query->where(['id' => 2])->scalar(), |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | |
847 | 847 | $this->queryCache->setEnable(false); |
848 | 848 | |
849 | - $db->cache(function () use ($query, $update) { |
|
849 | + $db->cache(function() use ($query, $update) { |
|
850 | 850 | $this->assertEquals( |
851 | 851 | 'user22', |
852 | 852 | $query->where(['id' => 2])->scalar(), |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | 'When Query has disabled cache, we get actual data' |
878 | 878 | ); |
879 | 879 | |
880 | - $db->cache(function () use ($query) { |
|
880 | + $db->cache(function() use ($query) { |
|
881 | 881 | $this->assertEquals('user1', $query->noCache()->where(['id' => 1])->scalar()); |
882 | 882 | $this->assertEquals('user11', $query->cache()->where(['id' => 1])->scalar()); |
883 | 883 | }, 10); |
@@ -310,8 +310,8 @@ |
||
310 | 310 | $string = ' DEFAULT '; |
311 | 311 | |
312 | 312 | $string .= match (gettype($this->default)) { |
313 | - 'object', 'integer' => (string)$this->default, |
|
314 | - 'double' => NumericHelper::normalize((string)$this->default), |
|
313 | + 'object', 'integer' => (string) $this->default, |
|
314 | + 'double' => NumericHelper::normalize((string) $this->default), |
|
315 | 315 | 'boolean' => $this->default ? 'TRUE' : 'FALSE', |
316 | 316 | default => "'{$this->default}'", |
317 | 317 | }; |
@@ -235,8 +235,8 @@ |
||
235 | 235 | public function dropCommentFromTable(string $table): string |
236 | 236 | { |
237 | 237 | return 'COMMENT ON TABLE ' |
238 | - . $this->quoter->quoteTableName($table) |
|
239 | - . ' IS NULL'; |
|
238 | + . $this->quoter->quoteTableName($table) |
|
239 | + . ' IS NULL'; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -325,7 +325,7 @@ |
||
325 | 325 | * |
326 | 326 | * @return array column list. |
327 | 327 | * @psalm-suppress ReferenceConstraintViolation |
328 | - */ |
|
328 | + */ |
|
329 | 329 | private function getTableUniqueColumnNames(string $name, array $columns, array &$constraints = []): array |
330 | 330 | { |
331 | 331 | $constraints = []; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | /** Remove duplicates */ |
350 | 350 | $constraints = array_combine( |
351 | 351 | array_map( |
352 | - static function (Constraint $constraint) { |
|
352 | + static function(Constraint $constraint) { |
|
353 | 353 | $columns = $constraint->getColumnNames() ?? []; |
354 | 354 | $columns = is_array($columns) ? $columns : [$columns]; |
355 | 355 | sort($columns, SORT_STRING); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $constraints = array_values( |
368 | 368 | array_filter( |
369 | 369 | $constraints, |
370 | - static function (Constraint $constraint) use ($quoter, $columns, &$columnNames) { |
|
370 | + static function(Constraint $constraint) use ($quoter, $columns, &$columnNames) { |
|
371 | 371 | /** @psalm-var string[]|string */ |
372 | 372 | $getColumnNames = $constraint->getColumnNames() ?? []; |
373 | 373 | $constraintColumnNames = []; |
@@ -585,7 +585,7 @@ |
||
585 | 585 | */ |
586 | 586 | protected function hasOffset(mixed $offset): bool |
587 | 587 | { |
588 | - return ($offset instanceof ExpressionInterface) || (ctype_digit((string)$offset) && (string)$offset !== '0'); |
|
588 | + return ($offset instanceof ExpressionInterface) || (ctype_digit((string) $offset) && (string) $offset !== '0'); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -142,7 +142,7 @@ |
||
142 | 142 | |
143 | 143 | protected function getCacheKey(int $queryMode, string $rawSql): array |
144 | 144 | { |
145 | - return array_merge([static::class , $queryMode], $this->db->getCacheKey(), [$rawSql]); |
|
145 | + return array_merge([static::class, $queryMode], $this->db->getCacheKey(), [$rawSql]); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | $this->expectException(Exception::class); |
204 | 204 | |
205 | - $db->transaction(function () use ($db) { |
|
205 | + $db->transaction(function() use ($db) { |
|
206 | 206 | $db->createCommand()->insert('profile', ['description' => 'test transaction shortcut'])->execute(); |
207 | 207 | throw new Exception('Exception in transaction shortcut'); |
208 | 208 | }); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | { |
217 | 217 | $db = $this->getConnection(true); |
218 | 218 | |
219 | - $result = $db->transaction(static function () use ($db) { |
|
219 | + $result = $db->transaction(static function() use ($db) { |
|
220 | 220 | $db->createCommand()->insert('profile', ['description' => 'test transaction shortcut'])->execute(); |
221 | 221 | return true; |
222 | 222 | }); |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | { |
240 | 240 | $db = $this->getConnection(); |
241 | 241 | |
242 | - $db->transaction(function (ConnectionInterface $db) { |
|
242 | + $db->transaction(function(ConnectionInterface $db) { |
|
243 | 243 | $this->assertNotNull($db->getTransaction()); |
244 | 244 | |
245 | - $db->transaction(function (ConnectionInterface $db) { |
|
245 | + $db->transaction(function(ConnectionInterface $db) { |
|
246 | 246 | $transaction = $db->getTransaction(); |
247 | 247 | $this->assertNotNull($transaction); |
248 | 248 | $transaction->rollBack(); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | $db->setEnableSavepoint(false); |
260 | 260 | |
261 | - $db->transaction(function (ConnectionInterface $db) { |
|
261 | + $db->transaction(function(ConnectionInterface $db) { |
|
262 | 262 | $this->assertNotNull($db->getTransaction()); |
263 | 263 | $this->expectException(NotSupportedException::class); |
264 | 264 | $db->beginTransaction(); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $row = $rows[2]; |
218 | 218 | $this->assertEquals(3, $row['id']); |
219 | 219 | $this->assertEquals('user3', $row['name']); |
220 | - $this->assertTrue(is_array($rows) && count($rows)>1 && count($rows[0]) === 2); |
|
220 | + $this->assertTrue(is_array($rows) && count($rows) > 1 && count($rows[0]) === 2); |
|
221 | 221 | |
222 | 222 | $rows = $db->createCommand('SELECT * FROM {{customer}} WHERE [[id]] = 10')->queryAll(); |
223 | 223 | $this->assertEquals([], $rows); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function testBatchInsertWithYield(): void |
260 | 260 | { |
261 | - $rows = (static function () { |
|
261 | + $rows = (static function() { |
|
262 | 262 | foreach ([['[email protected]', 'test name', 'test address']] as $row) { |
263 | 263 | yield $row; |
264 | 264 | } |
@@ -882,14 +882,14 @@ discard block |
||
882 | 882 | $update->bindValues([':id' => 1, ':name' => 'user11'])->execute(); |
883 | 883 | $this->assertEquals('user11', $command->bindValue(':id', 1)->queryScalar()); |
884 | 884 | |
885 | - $db->cache(function (ConnectionInterface $db) use ($command, $update) { |
|
885 | + $db->cache(function(ConnectionInterface $db) use ($command, $update) { |
|
886 | 886 | $this->assertEquals('user2', $command->bindValue(':id', 2)->queryScalar()); |
887 | 887 | |
888 | 888 | $update->bindValues([':id' => 2, ':name' => 'user22'])->execute(); |
889 | 889 | |
890 | 890 | $this->assertEquals('user2', $command->bindValue(':id', 2)->queryScalar()); |
891 | 891 | |
892 | - $db->noCache(function () use ($command) { |
|
892 | + $db->noCache(function() use ($command) { |
|
893 | 893 | $this->assertEquals('user22', $command->bindValue(':id', 2)->queryScalar()); |
894 | 894 | }); |
895 | 895 | |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | /** @psalm-suppress PossiblyNullReference */ |
900 | 900 | $this->queryCache->setEnable(false); |
901 | 901 | |
902 | - $db->cache(function () use ($command, $update) { |
|
902 | + $db->cache(function() use ($command, $update) { |
|
903 | 903 | $this->assertEquals('user22', $command->bindValue(':id', 2)->queryScalar()); |
904 | 904 | $update->bindValues([':id' => 2, ':name' => 'user2'])->execute(); |
905 | 905 | $this->assertEquals('user2', $command->bindValue(':id', 2)->queryScalar()); |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | |
917 | 917 | $command = $db->createCommand('SELECT [[name]] FROM {{customer}} WHERE [[id]] = :id'); |
918 | 918 | |
919 | - $db->cache(function () use ($command) { |
|
919 | + $db->cache(function() use ($command) { |
|
920 | 920 | $this->assertEquals('user11', $command->bindValue(':id', 1)->queryScalar()); |
921 | 921 | $this->assertEquals('user1', $command->noCache()->bindValue(':id', 1)->queryScalar()); |
922 | 922 | }, 10); |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | $this->invokeMethod( |
991 | 991 | $command, |
992 | 992 | 'setRetryHandler', |
993 | - [static function ($exception, $attempt) use (&$attempts, &$hitHandler) { |
|
993 | + [static function($exception, $attempt) use (&$attempts, &$hitHandler) { |
|
994 | 994 | $attempts = $attempt; |
995 | 995 | $hitHandler = true; |
996 | 996 |