| @@ -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 | } | 
| @@ -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(); |