@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @return null|int |
13 | 13 | */ |
14 | 14 | protected function getLimit(): ?int { |
15 | - if($this->limit instanceof OptionalValue) { |
|
15 | + if ($this->limit instanceof OptionalValue) { |
|
16 | 16 | return $this->limit->getValue(); |
17 | 17 | } |
18 | 18 | return $this->limit; |
@@ -34,18 +34,18 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected function buildLimit(string $query, ?int $offset = null) { |
36 | 36 | $limit = $this->getLimit(); |
37 | - if($limit === null && $offset !== null) { |
|
37 | + if ($limit === null && $offset !== null) { |
|
38 | 38 | $limit = '18446744073709551615'; |
39 | 39 | } |
40 | - if($this->limit instanceof OptionalValue) { |
|
41 | - if($this->limit->isValid()) { |
|
40 | + if ($this->limit instanceof OptionalValue) { |
|
41 | + if ($this->limit->isValid()) { |
|
42 | 42 | $value = $this->limit->getValue(); |
43 | - if(!preg_match('{\\d+}', $value)) { |
|
43 | + if (!preg_match('{\\d+}', $value)) { |
|
44 | 44 | throw new InvalidValueException('Value for LIMIT has to be a number'); |
45 | 45 | } |
46 | 46 | $query .= "LIMIT\n\t{$this->limit->getValue()}\n"; |
47 | 47 | } |
48 | - } elseif($limit !== null) { |
|
48 | + } elseif ($limit !== null) { |
|
49 | 49 | $query .= "LIMIT\n\t{$limit}\n"; |
50 | 50 | } |
51 | 51 | return $query; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return $this |
90 | 90 | */ |
91 | 91 | public function addExpr(string $str, ...$args) { |
92 | - if(count($args) > 0) { |
|
92 | + if (count($args) > 0) { |
|
93 | 93 | $this->fields[] = func_get_args(); |
94 | 94 | } else { |
95 | 95 | $this->fields[] = $str; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @return $this |
104 | 104 | */ |
105 | 105 | public function updateExpr(string $str, ...$args) { |
106 | - if(count($args) > 0) { |
|
106 | + if (count($args) > 0) { |
|
107 | 107 | $this->update[] = func_get_args(); |
108 | 108 | } else { |
109 | 109 | $this->update[] = $str; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return $this |
118 | 118 | */ |
119 | 119 | public function addOrUpdateExpr(string $expr, ...$args) { |
120 | - if(count($args) > 0) { |
|
120 | + if (count($args) > 0) { |
|
121 | 121 | $this->fields[] = func_get_args(); |
122 | 122 | $this->update[] = func_get_args(); |
123 | 123 | } else { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @return $this |
135 | 135 | */ |
136 | 136 | public function addAll(array $data, array $mask = null, array $excludeFields = null) { |
137 | - $this->addAllTo($data, $mask, $excludeFields, function ($field, $value) { |
|
137 | + $this->addAllTo($data, $mask, $excludeFields, function($field, $value) { |
|
138 | 138 | $this->add($field, $value); |
139 | 139 | }); |
140 | 140 | return $this; |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @return $this |
148 | 148 | */ |
149 | 149 | public function updateAll(array $data, array $mask = null, array $excludeFields = null) { |
150 | - $this->addAllTo($data, $mask, $excludeFields, function ($field, $value) { |
|
151 | - if($field !== $this->keyField) { |
|
150 | + $this->addAllTo($data, $mask, $excludeFields, function($field, $value) { |
|
151 | + if ($field !== $this->keyField) { |
|
152 | 152 | $this->update($field, $value); |
153 | 153 | } |
154 | 154 | }); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return string |
193 | 193 | */ |
194 | 194 | public function __toString(): string { |
195 | - if($this->table === null) { |
|
195 | + if ($this->table === null) { |
|
196 | 196 | throw new RuntimeException('Specify a table-name'); |
197 | 197 | } |
198 | 198 | |
@@ -202,21 +202,21 @@ discard block |
||
202 | 202 | $ignoreStr = $this->ignore ? ' IGNORE' : ''; |
203 | 203 | $queryArr[] = "INSERT{$ignoreStr} INTO\n\t{$tableName}\n"; |
204 | 204 | |
205 | - if($this->from !== null) { |
|
205 | + if ($this->from !== null) { |
|
206 | 206 | $fields = $this->from->getFields(); |
207 | 207 | $queryArr[] = sprintf("\t(%s)\n", implode(', ', array_keys($fields))); |
208 | 208 | $queryArr[] = $this->from; |
209 | 209 | } else { |
210 | 210 | $fields = $this->fields; |
211 | 211 | $insertData = $this->buildFieldList($fields); |
212 | - if(!count($insertData)) { |
|
212 | + if (!count($insertData)) { |
|
213 | 213 | throw new RuntimeException('No field-data found'); |
214 | 214 | } |
215 | 215 | $queryArr[] = sprintf("SET\n%s\n", implode(",\n", $insertData)); |
216 | 216 | } |
217 | 217 | |
218 | 218 | $updateData = $this->buildUpdate(); |
219 | - if($updateData) { |
|
219 | + if ($updateData) { |
|
220 | 220 | $queryArr[] = "{$updateData}\n"; |
221 | 221 | } |
222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return array<string|int, mixed> |
231 | 231 | */ |
232 | 232 | private function addTo(array $fields, string $field, $value): array { |
233 | - if(!$this->isFieldNameValid($field)) { |
|
233 | + if (!$this->isFieldNameValid($field)) { |
|
234 | 234 | throw new UnexpectedValueException('Field name is invalid'); |
235 | 235 | } |
236 | 236 | $sqlField = $field; |
@@ -246,18 +246,18 @@ discard block |
||
246 | 246 | * @param callable(string, mixed): void $fn |
247 | 247 | */ |
248 | 248 | private function addAllTo(array $data, ?array $mask, ?array $excludeFields, $fn): void { |
249 | - if($mask !== null) { |
|
249 | + if ($mask !== null) { |
|
250 | 250 | $data = array_intersect_key($data, array_combine($mask, $mask)); |
251 | 251 | } |
252 | - if($excludeFields !== null) { |
|
253 | - foreach($excludeFields as $excludeField) { |
|
254 | - if(array_key_exists($excludeField, $data)) { |
|
252 | + if ($excludeFields !== null) { |
|
253 | + foreach ($excludeFields as $excludeField) { |
|
254 | + if (array_key_exists($excludeField, $data)) { |
|
255 | 255 | unset($data[$excludeField]); |
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
259 | 259 | $data = $this->clearValues($data); |
260 | - foreach($data as $field => $value) { |
|
260 | + foreach ($data as $field => $value) { |
|
261 | 261 | $fn($field, $value); |
262 | 262 | } |
263 | 263 | } |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function buildUpdate(): string { |
269 | 269 | $queryArr = []; |
270 | - if(!empty($this->update)) { |
|
270 | + if (!empty($this->update)) { |
|
271 | 271 | $queryArr[] = "ON DUPLICATE KEY UPDATE\n"; |
272 | 272 | $updateArr = []; |
273 | - if($this->keyField !== null) { |
|
273 | + if ($this->keyField !== null) { |
|
274 | 274 | $updateArr[] = "\t`{$this->keyField}` = LAST_INSERT_ID({$this->keyField})"; |
275 | 275 | } |
276 | 276 | $updateArr = $this->buildFieldList($this->update, $updateArr); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @return array<string, mixed> |
294 | 294 | */ |
295 | 295 | private function clearValues(array $values): array { |
296 | - if(!count($values)) { |
|
296 | + if (!count($values)) { |
|
297 | 297 | return []; |
298 | 298 | } |
299 | 299 | |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | $fields = $this->db()->getTableFields($tableName); |
302 | 302 | $result = []; |
303 | 303 | |
304 | - foreach($values as $fieldName => $fieldValue) { |
|
305 | - if(in_array($fieldName, $fields)) { |
|
304 | + foreach ($values as $fieldName => $fieldValue) { |
|
305 | + if (in_array($fieldName, $fields)) { |
|
306 | 306 | $result[$fieldName] = $fieldValue; |
307 | 307 | } |
308 | 308 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | /** @link http://php.net/manual/en/class.exception.php#Hcom115813 (cHao's comment) */ |
20 | 20 | $code = is_array($errorInfo) && isset($errorInfo[1]) ? ((int) $errorInfo[1]) : ((int) $exception->getCode()); |
21 | 21 | $message = $exception->getMessage(); |
22 | - switch($code) { |
|
22 | + switch ($code) { |
|
23 | 23 | case 2006: return new DatabaseHasGoneAwayException($message, $code, $exception); |
24 | 24 | case 1213: return new SqlDeadLockException($message, $code, $exception); |
25 | 25 | case 1205: return new LockWaitTimeoutExceededException($message, $code, $exception); |
@@ -25,12 +25,12 @@ |
||
25 | 25 | $timer = microtime(true); |
26 | 26 | try { |
27 | 27 | return $fn(); |
28 | - } catch(Throwable $e) { |
|
28 | + } catch (Throwable $e) { |
|
29 | 29 | $exception = $e; |
30 | 30 | throw $e; |
31 | 31 | } finally { |
32 | - $finalTimer = microtime(true) - $timer; |
|
33 | - if($exception === null) { |
|
32 | + $finalTimer = microtime(true)-$timer; |
|
33 | + if ($exception === null) { |
|
34 | 34 | $this->log($query, $finalTimer); |
35 | 35 | } else { |
36 | 36 | $this->logError($query, $exception, $finalTimer); |
@@ -10,10 +10,10 @@ |
||
10 | 10 | */ |
11 | 11 | public static function getFieldTypes(QueryStatement $statement): array { |
12 | 12 | $fieldTypes = []; |
13 | - for($i = 0; $column = $statement->getColumnMeta($i); $i++) { |
|
13 | + for ($i = 0; $column = $statement->getColumnMeta($i); $i++) { |
|
14 | 14 | $name = $column['name'] ?? null; |
15 | 15 | $nativeType = $column['native_type'] ?? null; |
16 | - if(is_string($name) && is_string($nativeType)) { |
|
16 | + if (is_string($name) && is_string($nativeType)) { |
|
17 | 17 | $fieldTypes[$name] = self::getTypeFromNativeType($nativeType); |
18 | 18 | } |
19 | 19 | } |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | * @return string |
25 | 25 | */ |
26 | 26 | public function quote($value): string { |
27 | - if(is_null($value)) { |
|
27 | + if (is_null($value)) { |
|
28 | 28 | return 'NULL'; |
29 | 29 | } |
30 | 30 | |
31 | - if(is_bool($value)) { |
|
31 | + if (is_bool($value)) { |
|
32 | 32 | return $value ? '1' : '0'; |
33 | 33 | } |
34 | 34 | |
35 | - if(is_array($value)) { |
|
35 | + if (is_array($value)) { |
|
36 | 36 | return implode(', ', array_map([$this, __FUNCTION__], $value)); |
37 | 37 | } |
38 | 38 | |
39 | - if($value instanceof DBExpr) { |
|
39 | + if ($value instanceof DBExpr) { |
|
40 | 40 | return $value->getExpression(); |
41 | 41 | } |
42 | 42 | |
43 | - if($value instanceof Select) { |
|
43 | + if ($value instanceof Select) { |
|
44 | 44 | return sprintf('(%s)', (string) $value); |
45 | 45 | } |
46 | 46 | |
47 | - if(is_int($value) || is_float($value)) { |
|
47 | + if (is_int($value) || is_float($value)) { |
|
48 | 48 | return (string) $value; |
49 | 49 | } |
50 | 50 | |
51 | - if($value instanceof DateTimeInterface) { |
|
51 | + if ($value instanceof DateTimeInterface) { |
|
52 | 52 | $value = date_create_immutable($value->format('c'))->setTimezone($this->timeZone)->format('Y-m-d H:i:s'); |
53 | 53 | } |
54 | 54 | |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function quoteExpression(string $expression, array $arguments = []): string { |
64 | 64 | $index = -1; |
65 | - $func = function () use ($arguments, &$index) { |
|
65 | + $func = function() use ($arguments, &$index) { |
|
66 | 66 | $index++; |
67 | - if(array_key_exists($index, $arguments)) { |
|
67 | + if (array_key_exists($index, $arguments)) { |
|
68 | 68 | $argument = $arguments[$index]; |
69 | 69 | $value = $this->quote($argument); |
70 | - } elseif(count($arguments) > 0) { |
|
70 | + } elseif (count($arguments) > 0) { |
|
71 | 71 | $args = $arguments; |
72 | 72 | $value = array_pop($args); |
73 | 73 | $value = $this->quote($value); |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function setFetchMode(int $mode = PDO::FETCH_ASSOC, $arg0 = null, ?array $arg1 = null) { |
49 | 49 | $args = [$mode]; |
50 | - if($arg0 !== null) { |
|
50 | + if ($arg0 !== null) { |
|
51 | 51 | $args[] = $arg0; |
52 | 52 | } |
53 | - if($arg1 !== null) { |
|
53 | + if ($arg1 !== null) { |
|
54 | 54 | $args[] = $arg1; |
55 | 55 | } |
56 | 56 | $this->statement->setFetchMode(...$args); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->exceptionHandler(function() use ($params) { |
67 | 67 | $this->queryLoggers->logRegion($this->query, function() use ($params) { |
68 | 68 | $response = $this->statement->execute($params); |
69 | - if(!$response) { |
|
69 | + if (!$response) { |
|
70 | 70 | throw new SqlException('Execution returned with "false".'); |
71 | 71 | } |
72 | 72 | }); |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function fetchAll($fetchStyle = PDO::FETCH_ASSOC, $fetchArgument = null, array $ctorArgs = []): array { |
84 | 84 | $result = $x = $this->exceptionHandler(function() use ($fetchStyle, $fetchArgument, $ctorArgs) { |
85 | - if($fetchArgument !== null) { |
|
85 | + if ($fetchArgument !== null) { |
|
86 | 86 | return $this->statement->fetchAll($fetchStyle, $fetchArgument, ...$ctorArgs); |
87 | 87 | } |
88 | 88 | return $this->statement->fetchAll($fetchStyle); |
89 | 89 | }); |
90 | 90 | /** @var array<mixed, mixed>|false $x */ |
91 | - if($x === false) { |
|
91 | + if ($x === false) { |
|
92 | 92 | return []; |
93 | 93 | } |
94 | 94 | return $result; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function getColumnMeta(int $columnNo): ?array { |
142 | 142 | return $this->exceptionHandler(function() use ($columnNo) { |
143 | 143 | $columnMeta = $this->statement->getColumnMeta($columnNo); |
144 | - if($columnMeta === false) { |
|
144 | + if ($columnMeta === false) { |
|
145 | 145 | return null; |
146 | 146 | } |
147 | 147 | return $columnMeta; |
@@ -8,10 +8,10 @@ |
||
8 | 8 | use Rector\Php80\Rector\FunctionLike\MixedTypeRector; |
9 | 9 | use Rector\Set\ValueObject\LevelSetList; |
10 | 10 | |
11 | -return static function (RectorConfig $rectorConfig): void { |
|
11 | +return static function(RectorConfig $rectorConfig): void { |
|
12 | 12 | $rectorConfig->paths([ |
13 | - __DIR__ . '/src', |
|
14 | - __DIR__ . '/tests', |
|
13 | + __DIR__.'/src', |
|
14 | + __DIR__.'/tests', |
|
15 | 15 | ]); |
16 | 16 | |
17 | 17 | // register a single rule |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param array<string, mixed> $options |
52 | 52 | */ |
53 | 53 | public function __construct(PDO $pdo, array $options = []) { |
54 | - if($pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_SILENT) { |
|
54 | + if ($pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_SILENT) { |
|
55 | 55 | $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
56 | 56 | } |
57 | 57 | $this->pdo = $pdo; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ]; |
67 | 67 | $this->options = array_merge($defaultOptions, $options); |
68 | 68 | $this->options['timezone'] = $this->options['timezone'] ?? date_default_timezone_get(); |
69 | - if(!($this->options['timezone'] instanceof DateTimeZone)) { |
|
69 | + if (!($this->options['timezone'] instanceof DateTimeZone)) { |
|
70 | 70 | $this->options['timezone'] = new DateTimeZone((string) $this->options['timezone']); |
71 | 71 | } |
72 | 72 | $this->quoter = new MySQLQuoter($pdo, $this->options['timezone']); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return VirtualTables |
91 | 91 | */ |
92 | 92 | public function getVirtualTables(): VirtualTables { |
93 | - if($this->virtualTables === null) { |
|
93 | + if ($this->virtualTables === null) { |
|
94 | 94 | $this->virtualTables = new VirtualTables(); |
95 | 95 | } |
96 | 96 | return $this->virtualTables; |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | array $params = [] |
136 | 136 | ): int { |
137 | 137 | return $this->getQueryLoggers()->logRegion($query, fn() => |
138 | - $this->exceptionHandler(function () use ($query, $params) { |
|
138 | + $this->exceptionHandler(function() use ($query, $params) { |
|
139 | 139 | $stmt = $this->pdo->prepare($query); |
140 | 140 | $timer = microtime(true); |
141 | 141 | $stmt->execute($params); |
142 | - $this->queryLoggers->log($query, microtime(true) - $timer); |
|
142 | + $this->queryLoggers->log($query, microtime(true)-$timer); |
|
143 | 143 | $result = $stmt->rowCount(); |
144 | 144 | $stmt->closeCursor(); |
145 | 145 | return $result; |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function getTableFields(string $table): array { |
163 | 163 | $fqTable = $this->select()->aliasReplacer()->replace($table); |
164 | - if(array_key_exists($fqTable, $this->tableFields)) { |
|
164 | + if (array_key_exists($fqTable, $this->tableFields)) { |
|
165 | 165 | return $this->tableFields[$fqTable]; |
166 | 166 | } |
167 | 167 | $query = "DESCRIBE {$fqTable}"; |
168 | 168 | return $this->getQueryLoggers()->logRegion($query, fn() => |
169 | - $this->exceptionHandler(function () use ($query, $fqTable) { |
|
169 | + $this->exceptionHandler(function() use ($query, $fqTable) { |
|
170 | 170 | $stmt = $this->pdo->query($query); |
171 | 171 | try { |
172 | - if($stmt === false) { |
|
172 | + if ($stmt === false) { |
|
173 | 173 | throw new RuntimeException('Invalid return type'); |
174 | 174 | } |
175 | 175 | $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $select = array_key_exists('select-factory', $this->options) |
218 | 218 | ? call_user_func($this->options['select-factory'], $this, $this->options['select-options']) |
219 | 219 | : new MySQL\MySQLRunnableSelect($this, $this->options['select-options']); |
220 | - if($fields !== null) { |
|
220 | + if ($fields !== null) { |
|
221 | 221 | $select->fields($fields); |
222 | 222 | } |
223 | 223 | return $select; |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $insert = array_key_exists('insert-factory', $this->options) |
232 | 232 | ? call_user_func($this->options['insert-factory'], $this, $this->options['insert-options']) |
233 | 233 | : new Builder\RunnableInsert($this, $this->options['insert-options']); |
234 | - if($fields !== null) { |
|
234 | + if ($fields !== null) { |
|
235 | 235 | $insert->addAll($fields); |
236 | 236 | } |
237 | 237 | return $insert; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $update = array_key_exists('update-factory', $this->options) |
246 | 246 | ? call_user_func($this->options['update-factory'], $this, $this->options['update-options']) |
247 | 247 | : new Builder\RunnableUpdate($this, $this->options['update-options']); |
248 | - if($fields !== null) { |
|
248 | + if ($fields !== null) { |
|
249 | 249 | $update->setAll($fields); |
250 | 250 | } |
251 | 251 | return $update; |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | * @return $this |
265 | 265 | */ |
266 | 266 | public function transactionStart() { |
267 | - if($this->transactionLevel === 0) { |
|
268 | - if($this->pdo->inTransaction()) { |
|
267 | + if ($this->transactionLevel === 0) { |
|
268 | + if ($this->pdo->inTransaction()) { |
|
269 | 269 | $this->outerTransaction = true; |
270 | 270 | } else { |
271 | 271 | $this->pdo->beginTransaction(); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @return $this |
280 | 280 | */ |
281 | 281 | public function transactionCommit() { |
282 | - return $this->transactionEnd(function () { |
|
282 | + return $this->transactionEnd(function() { |
|
283 | 283 | $this->pdo->commit(); |
284 | 284 | }); |
285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @return $this |
289 | 289 | */ |
290 | 290 | public function transactionRollback() { |
291 | - return $this->transactionEnd(function () { |
|
291 | + return $this->transactionEnd(function() { |
|
292 | 292 | $this->pdo->rollBack(); |
293 | 293 | }); |
294 | 294 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @return T |
300 | 300 | */ |
301 | 301 | public function dryRun(callable $callback) { |
302 | - if(!$this->pdo->inTransaction()) { |
|
302 | + if (!$this->pdo->inTransaction()) { |
|
303 | 303 | $this->transactionStart(); |
304 | 304 | try { |
305 | 305 | return $callback($this); |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @throws Throwable |
325 | 325 | */ |
326 | 326 | public function transaction(callable $callback) { |
327 | - if(!$this->pdo->inTransaction()) { |
|
327 | + if (!$this->pdo->inTransaction()) { |
|
328 | 328 | $this->transactionStart(); |
329 | 329 | try { |
330 | 330 | $result = $callback($this); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | return $result; |
333 | 333 | } catch (Throwable $e) { |
334 | 334 | // @phpstan-ignore-next-line; If condition is always false as it is not. |
335 | - if($this->pdo->inTransaction()) { |
|
335 | + if ($this->pdo->inTransaction()) { |
|
336 | 336 | $this->transactionRollback(); |
337 | 337 | } |
338 | 338 | throw $e; |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | */ |
357 | 357 | private function transactionEnd($fn): self { |
358 | 358 | $this->transactionLevel--; |
359 | - if($this->transactionLevel < 0) { |
|
359 | + if ($this->transactionLevel < 0) { |
|
360 | 360 | throw new RuntimeException("Transaction-Nesting-Problem: Trying to invoke commit on a already closed transaction"); |
361 | 361 | } |
362 | - if($this->transactionLevel < 1) { |
|
363 | - if($this->outerTransaction) { |
|
362 | + if ($this->transactionLevel < 1) { |
|
363 | + if ($this->outerTransaction) { |
|
364 | 364 | $this->outerTransaction = false; |
365 | 365 | } else { |
366 | 366 | $fn(); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | private function buildQueryStatement(string $query, callable $fn): QueryStatement { |
379 | 379 | $stmt = $fn($query); |
380 | - if(!$stmt) { |
|
380 | + if (!$stmt) { |
|
381 | 381 | throw new RuntimeException("Could not execute statement:\n{$query}"); |
382 | 382 | } |
383 | 383 | return new QueryStatement($stmt, $query, $this->exceptionInterpreter, $this->queryLoggers); |