@@ -64,7 +64,7 @@ |
||
64 | 64 | $key = $this->queryBuilder->quoter()->quoteColumnName(reset($pk)); |
65 | 65 | $value = "(SELECT COALESCE(MAX($key),0) FROM $tableName)+1"; |
66 | 66 | } else { |
67 | - $value = (int)$value; |
|
67 | + $value = (int) $value; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return "DBCC CHECKIDENT ('$tableName', RESEED, $value)"; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | /** @var SchemaPDOMssql */ |
68 | 68 | $schemaInstance = $this->queryBuilder->schema(); |
69 | 69 | $defaultSchema = $schema ?: $schemaInstance->getDefaultSchema(); |
70 | - $tableNames = $schemaInstance->getTableSchema($table) |
|
70 | + $tableNames = $schemaInstance->getTableSchema($table) |
|
71 | 71 | ? [$table] : $schemaInstance->getTableNames($defaultSchema); |
72 | 72 | $viewNames = $schemaInstance->getViewNames($defaultSchema); |
73 | 73 | $tableNames = array_diff($tableNames, $viewNames); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $tables = $this->db->createCommand($sql, [':schema' => $schema])->queryColumn(); |
244 | 244 | |
245 | - return array_map(static function ($item) { |
|
245 | + return array_map(static function($item) { |
|
246 | 246 | return '[' . $item . ']'; |
247 | 247 | }, $tables); |
248 | 248 | } |
@@ -1039,12 +1039,12 @@ discard block |
||
1039 | 1039 | */ |
1040 | 1040 | protected function normalizePdoRowKeyCase(array $row, bool $multiple): array |
1041 | 1041 | { |
1042 | - if ($this->db->getSlavePdo()?->getAttribute(PDO::ATTR_CASE) !== PDO::CASE_UPPER) { |
|
1042 | + if ($this->db->getSlavePdo() ? ->getAttribute(PDO::ATTR_CASE) !== PDO::CASE_UPPER) { |
|
1043 | 1043 | return $row; |
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | if ($multiple) { |
1047 | - return array_map(static function (array $row) { |
|
1047 | + return array_map(static function(array $row) { |
|
1048 | 1048 | return array_change_key_case($row, CASE_LOWER); |
1049 | 1049 | }, $row); |
1050 | 1050 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | if ($this->pdo !== null) { |
117 | - $this->logger?->log( |
|
117 | + $this->logger ? ->log( |
|
118 | 118 | LogLevel::DEBUG, |
119 | 119 | 'Closing DB connection: ' . $this->driver->getDsn() . ' ' . __METHOD__, |
120 | 120 | ); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | { |
183 | 183 | if ($this->serverVersion === '') { |
184 | 184 | /** @var mixed */ |
185 | - $version = $this->getSlavePDO()?->getAttribute(PDO::ATTR_SERVER_VERSION); |
|
185 | + $version = $this->getSlavePDO() ? ->getAttribute(PDO::ATTR_SERVER_VERSION); |
|
186 | 186 | $this->serverVersion = is_string($version) ? $version : 'Version could not be determined.'; |
187 | 187 | } |
188 | 188 | |
@@ -240,13 +240,13 @@ discard block |
||
240 | 240 | $token = 'Opening DB connection: ' . $this->driver->getDsn(); |
241 | 241 | |
242 | 242 | try { |
243 | - $this->logger?->log(LogLevel::INFO, $token); |
|
244 | - $this->profiler?->begin($token, [__METHOD__]); |
|
243 | + $this->logger ? ->log(LogLevel::INFO, $token); |
|
244 | + $this->profiler ? ->begin($token, [__METHOD__]); |
|
245 | 245 | $this->initConnection(); |
246 | - $this->profiler?->end($token, [__METHOD__]); |
|
246 | + $this->profiler ? ->end($token, [__METHOD__]); |
|
247 | 247 | } catch (PDOException $e) { |
248 | - $this->profiler?->end($token, [__METHOD__]); |
|
249 | - $this->logger?->log(LogLevel::ERROR, $token); |
|
248 | + $this->profiler ? ->end($token, [__METHOD__]); |
|
249 | + $this->logger ? ->log(LogLevel::ERROR, $token); |
|
250 | 250 | |
251 | 251 | throw new Exception($e->getMessage(), (array) $e->errorInfo, $e); |
252 | 252 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | && $this->isolationLevel !== null |
81 | 81 | && $this->db->getTransaction() === null |
82 | 82 | ) { |
83 | - $this->db->transaction(fn (string $rawSql) => $this->internalExecute($rawSql), $this->isolationLevel); |
|
83 | + $this->db->transaction(fn(string $rawSql) => $this->internalExecute($rawSql), $this->isolationLevel); |
|
84 | 84 | } else { |
85 | 85 | $this->pdoStatement->execute(); |
86 | 86 | } |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | $this->db->getSchema()->setTransactionIsolationLevel($isolationLevel); |
61 | 61 | } |
62 | 62 | |
63 | - $this->logger?->log( |
|
63 | + $this->logger ? ->log( |
|
64 | 64 | LogLevel::DEBUG, |
65 | 65 | 'Begin transaction' . ($isolationLevel ? ' with isolation level ' . $isolationLevel : '') |
66 | 66 | . ' ' . __METHOD__ |
67 | 67 | ); |
68 | 68 | |
69 | - $this->db->getPDO()?->beginTransaction(); |
|
69 | + $this->db->getPDO() ? ->beginTransaction(); |
|
70 | 70 | $this->level = 1; |
71 | 71 | |
72 | 72 | return; |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | $schema = $this->db->getSchema(); |
76 | 76 | |
77 | 77 | if ($schema->supportsSavepoint()) { |
78 | - $this->logger?->log(LogLevel::DEBUG, 'Set savepoint ' . $this->level . ' ' . __METHOD__); |
|
78 | + $this->logger ? ->log(LogLevel::DEBUG, 'Set savepoint ' . $this->level . ' ' . __METHOD__); |
|
79 | 79 | $schema->createSavepoint('LEVEL' . $this->level); |
80 | 80 | } else { |
81 | - $this->logger?->log( |
|
81 | + $this->logger ? ->log( |
|
82 | 82 | LogLevel::DEBUG, |
83 | 83 | 'Transaction not started: nested transaction not supported ' . __METHOD__ |
84 | 84 | ); |
@@ -102,18 +102,18 @@ discard block |
||
102 | 102 | $this->level--; |
103 | 103 | |
104 | 104 | if ($this->level === 0) { |
105 | - $this->logger?->log(LogLevel::DEBUG, 'Commit transaction ' . __METHOD__); |
|
106 | - $this->db->getPDO()?->commit(); |
|
105 | + $this->logger ? ->log(LogLevel::DEBUG, 'Commit transaction ' . __METHOD__); |
|
106 | + $this->db->getPDO() ? ->commit(); |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | $schema = $this->db->getSchema(); |
111 | 111 | |
112 | 112 | if ($schema->supportsSavepoint()) { |
113 | - $this->logger?->log(LogLevel::DEBUG, 'Release savepoint ' . $this->level . ' ' . __METHOD__); |
|
113 | + $this->logger ? ->log(LogLevel::DEBUG, 'Release savepoint ' . $this->level . ' ' . __METHOD__); |
|
114 | 114 | $schema->releaseSavepoint('LEVEL' . $this->level); |
115 | 115 | } else { |
116 | - $this->logger?->log( |
|
116 | + $this->logger ? ->log( |
|
117 | 117 | LogLevel::INFO, |
118 | 118 | 'Transaction not committed: nested transaction not supported ' . __METHOD__ |
119 | 119 | ); |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | |
146 | 146 | $this->level--; |
147 | 147 | if ($this->level === 0) { |
148 | - $this->logger?->log(LogLevel::INFO, 'Roll back transaction ' . __METHOD__); |
|
149 | - $this->db->getPDO()?->rollBack(); |
|
148 | + $this->logger ? ->log(LogLevel::INFO, 'Roll back transaction ' . __METHOD__); |
|
149 | + $this->db->getPDO() ? ->rollBack(); |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $schema = $this->db->getSchema(); |
154 | 154 | if ($schema->supportsSavepoint()) { |
155 | - $this->logger?->log(LogLevel::DEBUG, 'Roll back to savepoint ' . $this->level . ' ' . __METHOD__); |
|
155 | + $this->logger ? ->log(LogLevel::DEBUG, 'Roll back to savepoint ' . $this->level . ' ' . __METHOD__); |
|
156 | 156 | $schema->rollBackSavepoint('LEVEL' . $this->level); |
157 | 157 | } else { |
158 | - $this->logger?->log( |
|
158 | + $this->logger ? ->log( |
|
159 | 159 | LogLevel::INFO, |
160 | 160 | 'Transaction not rolled back: nested transaction not supported ' . __METHOD__ |
161 | 161 | ); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | throw new Exception('Failed to set isolation level: transaction was inactive.'); |
169 | 169 | } |
170 | 170 | |
171 | - $this->logger?->log( |
|
171 | + $this->logger ? ->log( |
|
172 | 172 | LogLevel::DEBUG, |
173 | 173 | 'Setting transaction isolation level to ' . $this->level . ' ' . __METHOD__ |
174 | 174 | ); |