@@ -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 | } |
@@ -203,8 +203,8 @@ |
||
203 | 203 | public function dropCommentFromTable(string $table): string |
204 | 204 | { |
205 | 205 | return 'COMMENT ON TABLE ' |
206 | - . $this->queryBuilder->quoter()->quoteTableName($table) |
|
207 | - . ' IS NULL'; |
|
206 | + . $this->queryBuilder->quoter()->quoteTableName($table) |
|
207 | + . ' IS NULL'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | public function dropDefaultValue(string $name, string $table): string |
@@ -42,7 +42,7 @@ |
||
42 | 42 | ): mixed { |
43 | 43 | return $this->cache->getOrSet( |
44 | 44 | $key, |
45 | - static fn () => $value, |
|
45 | + static fn() => $value, |
|
46 | 46 | $ttl, |
47 | 47 | $dependency, |
48 | 48 | ); |
@@ -262,7 +262,7 @@ |
||
262 | 262 | |
263 | 263 | return $poolConnection; |
264 | 264 | } catch (Exception $e) { |
265 | - $this->logger?->log( |
|
265 | + $this->logger ? ->log( |
|
266 | 266 | LogLevel::WARNING, |
267 | 267 | "Connection ({$poolConnection->getDriver()->getDsn()}) failed: " . $e->getMessage() . ' ' . __METHOD__ |
268 | 268 | ); |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | return [ |
33 | 33 | 'drop' => [ |
34 | 34 | "ALTER TABLE {{{$tableName}}} DROP CONSTRAINT [[$name]]", |
35 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
35 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
36 | 36 | return $qb->dropForeignKey($name, $tableName); |
37 | 37 | }, |
38 | 38 | ], |
39 | 39 | 'add' => [ |
40 | 40 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] FOREIGN KEY ([[C_fk_id_1]])" |
41 | 41 | . " REFERENCES {{{$pkTableName}}} ([[C_id_1]]) ON DELETE CASCADE ON UPDATE CASCADE", |
42 | - static function (QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
42 | + static function(QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
43 | 43 | return $qb->addForeignKey( |
44 | 44 | $name, |
45 | 45 | $tableName, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'add (2 columns)' => [ |
55 | 55 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] FOREIGN KEY ([[C_fk_id_1]], [[C_fk_id_2]])" |
56 | 56 | . " REFERENCES {{{$pkTableName}}} ([[C_id_1]], [[C_id_2]]) ON DELETE CASCADE ON UPDATE CASCADE", |
57 | - static function (QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
57 | + static function(QueryBuilderInterface $qb) use ($tableName, $name, $pkTableName) { |
|
58 | 58 | return $qb->addForeignKey( |
59 | 59 | $name, |
60 | 60 | $tableName, |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | return [ |
78 | 78 | 'drop' => [ |
79 | 79 | "ALTER TABLE {{{$tableName}}} DROP CONSTRAINT [[$name]]", |
80 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
80 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
81 | 81 | return $qb->dropPrimaryKey($name, $tableName); |
82 | 82 | }, |
83 | 83 | ], |
84 | 84 | 'add' => [ |
85 | 85 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] PRIMARY KEY ([[C_id_1]])", |
86 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
86 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
87 | 87 | return $qb->addPrimaryKey($name, $tableName, 'C_id_1'); |
88 | 88 | }, |
89 | 89 | ], |
90 | 90 | 'add (2 columns)' => [ |
91 | 91 | "ALTER TABLE {{{$tableName}}} ADD CONSTRAINT [[$name]] PRIMARY KEY ([[C_id_1]], [[C_id_2]])", |
92 | - static function (QueryBuilderInterface $qb) use ($tableName, $name) { |
|
92 | + static function(QueryBuilderInterface $qb) use ($tableName, $name) { |
|
93 | 93 | return $qb->addPrimaryKey($name, $tableName, 'C_id_1, C_id_2'); |
94 | 94 | }, |
95 | 95 | ], |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | return [ |
107 | 107 | 'drop' => [ |
108 | 108 | "ALTER TABLE {{{$tableName1}}} DROP CONSTRAINT [[$name1]]", |
109 | - static function (QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
109 | + static function(QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
110 | 110 | return $qb->dropUnique($name1, $tableName1); |
111 | 111 | }, |
112 | 112 | ], |
113 | 113 | 'add' => [ |
114 | 114 | "ALTER TABLE {{{$tableName1}}} ADD CONSTRAINT [[$name1]] UNIQUE ([[C_unique]])", |
115 | - static function (QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
115 | + static function(QueryBuilderInterface $qb) use ($tableName1, $name1) { |
|
116 | 116 | return $qb->addUnique($name1, $tableName1, 'C_unique'); |
117 | 117 | }, |
118 | 118 | ], |
119 | 119 | 'add (2 columns)' => [ |
120 | 120 | "ALTER TABLE {{{$tableName2}}} ADD CONSTRAINT [[$name2]] UNIQUE ([[C_index_2_1]], [[C_index_2_2]])", |
121 | - static function (QueryBuilderInterface $qb) use ($tableName2, $name2) { |
|
121 | + static function(QueryBuilderInterface $qb) use ($tableName2, $name2) { |
|
122 | 122 | return $qb->addUnique($name2, $tableName2, 'C_index_2_1, C_index_2_2'); |
123 | 123 | }, |
124 | 124 | ], |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | [new Expression('NOT (any_expression(:a))', [':a' => 1]), 'NOT (any_expression(:a))', [':a' => 1]], |
495 | 495 | ]; |
496 | 496 | |
497 | - $conditions = match ($this->db->getDriverName()) { |
|
497 | + $conditions = match($this->db->getDriverName()) { |
|
498 | 498 | 'sqlsrv', 'sqlite' => array_merge($conditions, [ |
499 | 499 | [ |
500 | 500 | ['in', ['id', 'name'], [['id' => 1, 'name' => 'foo'], ['id' => 2, 'name' => 'bar']]], |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | [':qp0' => 1, |
503 | 503 | ':qp1' => 'foo', |
504 | 504 | ':qp2' => 2, |
505 | - ':qp3' => 'bar',], |
|
505 | + ':qp3' => 'bar', ], |
|
506 | 506 | ], |
507 | 507 | [ |
508 | 508 | ['not in', ['id', 'name'], [['id' => 1, 'name' => 'foo'], ['id' => 2, 'name' => 'bar']]], |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | [':qp0' => 1, |
511 | 511 | ':qp1' => 'foo', |
512 | 512 | ':qp2' => 2, |
513 | - ':qp3' => 'bar',], |
|
513 | + ':qp3' => 'bar', ], |
|
514 | 514 | ], |
515 | 515 | //[['in', ['id', 'name'], (new Query())->select(['id', 'name'])->from('users')->where(['active' => 1])], 'EXISTS (SELECT 1 FROM (SELECT [[id]], [[name]] FROM [[users]] WHERE [[active]]=:qp0) AS a WHERE a.[[id]] = [[id AND a.]]name[[ = ]]name`)', [':qp0' => 1] ], |
516 | 516 | //[ ['not in', ['id', 'name'], (new Query())->select(['id', 'name'])->from('users')->where(['active' => 1])], 'NOT EXISTS (SELECT 1 FROM (SELECT [[id]], [[name]] FROM [[users]] WHERE [[active]]=:qp0) AS a WHERE a.[[id]] = [[id]] AND a.[[name = ]]name`)', [':qp0' => 1] ], |
@@ -797,31 +797,31 @@ discard block |
||
797 | 797 | return [ |
798 | 798 | 'drop' => [ |
799 | 799 | "DROP INDEX [[$name1]] ON {{{$tableName}}}", |
800 | - static function (QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
800 | + static function(QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
801 | 801 | return $qb->dropIndex($name1, $tableName); |
802 | 802 | }, |
803 | 803 | ], |
804 | 804 | 'create' => [ |
805 | 805 | "CREATE INDEX [[$name1]] ON {{{$tableName}}} ([[C_index_1]])", |
806 | - static function (QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
806 | + static function(QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
807 | 807 | return $qb->createIndex($name1, $tableName, 'C_index_1'); |
808 | 808 | }, |
809 | 809 | ], |
810 | 810 | 'create (2 columns)' => [ |
811 | 811 | "CREATE INDEX [[$name2]] ON {{{$tableName}}} ([[C_index_2_1]], [[C_index_2_2]])", |
812 | - static function (QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
812 | + static function(QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
813 | 813 | return $qb->createIndex($name2, $tableName, 'C_index_2_1, C_index_2_2'); |
814 | 814 | }, |
815 | 815 | ], |
816 | 816 | 'create unique' => [ |
817 | 817 | "CREATE UNIQUE INDEX [[$name1]] ON {{{$tableName}}} ([[C_index_1]])", |
818 | - static function (QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
818 | + static function(QueryBuilderInterface $qb) use ($tableName, $name1) { |
|
819 | 819 | return $qb->createIndex($name1, $tableName, 'C_index_1', true); |
820 | 820 | }, |
821 | 821 | ], |
822 | 822 | 'create unique (2 columns)' => [ |
823 | 823 | "CREATE UNIQUE INDEX [[$name2]] ON {{{$tableName}}} ([[C_index_2_1]], [[C_index_2_2]])", |
824 | - static function (QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
824 | + static function(QueryBuilderInterface $qb) use ($tableName, $name2) { |
|
825 | 825 | return $qb->createIndex($name2, $tableName, 'C_index_2_1, C_index_2_2', true); |
826 | 826 | }, |
827 | 827 | ], |
@@ -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 |
@@ -185,7 +185,7 @@ |
||
185 | 185 | */ |
186 | 186 | protected function replaceQuotes($sql): string|array|null |
187 | 187 | { |
188 | - return match ($this->drivername) { |
|
188 | + return match($this->drivername) { |
|
189 | 189 | 'mysql', 'sqlite' => str_replace(['[[', ']]'], '`', $sql), |
190 | 190 | 'oci' => str_replace(['[[', ']]'], '"', $sql), |
191 | 191 | 'pgsql' => str_replace(['\\[', '\\]'], ['[', ']'], preg_replace('/(\[\[)|((?<!(\[))]])/', '"', $sql)), |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public static function replaceQuotes(string $sql, string $drivername): string |
18 | 18 | { |
19 | - return match ($drivername) { |
|
19 | + return match($drivername) { |
|
20 | 20 | 'mysql', 'sqlite' => str_replace(['[[', ']]'], '`', $sql), |
21 | 21 | 'oci' => str_replace(['[[', ']]'], '"', $sql), |
22 | 22 | 'pgsql' => str_replace(['\\[', '\\]'], ['[', ']'], preg_replace('/(\[\[)|((?<!(\[))]])/', '"', $sql)), |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $this->expectException(Exception::class); |
73 | 73 | |
74 | - $db->transaction(function () use ($db) { |
|
74 | + $db->transaction(function() use ($db) { |
|
75 | 75 | $db->createCommand()->insert('profile', ['description' => 'test transaction shortcut'])->execute(); |
76 | 76 | throw new Exception('Exception in transaction shortcut'); |
77 | 77 | }); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $db = $this->getConnection(true); |
87 | 87 | |
88 | - $result = $db->transaction(static function () use ($db) { |
|
88 | + $result = $db->transaction(static function() use ($db) { |
|
89 | 89 | $db->createCommand()->insert('profile', ['description' => 'test transaction shortcut'])->execute(); |
90 | 90 | return true; |
91 | 91 | }); |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | { |
109 | 109 | $db = $this->getConnection(); |
110 | 110 | |
111 | - $db->transaction(function (ConnectionInterface $db) { |
|
111 | + $db->transaction(function(ConnectionInterface $db) { |
|
112 | 112 | $this->assertNotNull($db->getTransaction()); |
113 | 113 | |
114 | - $db->transaction(function (ConnectionInterface $db) { |
|
114 | + $db->transaction(function(ConnectionInterface $db) { |
|
115 | 115 | $this->assertNotNull($db->getTransaction()); |
116 | 116 | $db->getTransaction()->rollBack(); |
117 | 117 | }); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | $db->setEnableSavepoint(false); |
128 | 128 | |
129 | - $db->transaction(function (ConnectionInterface $db) { |
|
129 | + $db->transaction(function(ConnectionInterface $db) { |
|
130 | 130 | $this->assertNotNull($db->getTransaction()); |
131 | 131 | $this->expectException(NotSupportedException::class); |
132 | 132 | $db->beginTransaction(); |