Passed
Push — master ( e79fe2...6f2ee6 )
by Ron
02:55
created
src/Databases/MySQL/MySQLQuoter.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,31 +24,31 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Databases/MySQL.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @param array<string, mixed> $options
51 51
 	 */
52 52
 	public function __construct(PDO $pdo, array $options = []) {
53
-		if($pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_SILENT) {
53
+		if ($pdo->getAttribute(PDO::ATTR_ERRMODE) === PDO::ERRMODE_SILENT) {
54 54
 			$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
55 55
 		}
56 56
 		$this->pdo = $pdo;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		];
66 66
 		$this->options = array_merge($defaultOptions, $options);
67 67
 		$this->options['timezone'] = $this->options['timezone'] ?? date_default_timezone_get();
68
-		if(!($this->options['timezone'] instanceof DateTimeZone)) {
68
+		if (!($this->options['timezone'] instanceof DateTimeZone)) {
69 69
 			$this->options['timezone'] = new DateTimeZone((string) $this->options['timezone']);
70 70
 		}
71 71
 		$this->quoter = new MySQLQuoter($pdo, $this->options['timezone']);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return VirtualTables
90 90
 	 */
91 91
 	public function getVirtualTables(): VirtualTables {
92
-		if($this->virtualTables === null) {
92
+		if ($this->virtualTables === null) {
93 93
 			$this->virtualTables = new VirtualTables();
94 94
 		}
95 95
 		return $this->virtualTables;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function query(string $query) {
103 103
 		return $this->getQueryLoggers()->logRegion($query, function() use ($query) {
104
-			return $this->buildQueryStatement($query, function ($query) {
104
+			return $this->buildQueryStatement($query, function($query) {
105 105
 				return $this->pdo->query($query);
106 106
 			});
107 107
 		});
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @return QueryStatement
113 113
 	 */
114 114
 	public function prepare(string $query) {
115
-		return $this->buildQueryStatement((string) $query, function ($query) {
115
+		return $this->buildQueryStatement((string) $query, function($query) {
116 116
 			return $this->pdo->prepare($query);
117 117
 		});
118 118
 	}
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function exec(string $query, array $params = []): int {
126 126
 		return $this->getQueryLoggers()->logRegion($query, function() use ($query, $params) {
127
-			return $this->exceptionHandler(function () use ($query, $params) {
127
+			return $this->exceptionHandler(function() use ($query, $params) {
128 128
 				$stmt = $this->pdo->prepare($query);
129 129
 				$timer = microtime(true);
130 130
 				$stmt->execute($params);
131
-				$this->queryLoggers->log($query, microtime(true) - $timer);
131
+				$this->queryLoggers->log($query, microtime(true)-$timer);
132 132
 				$result = $stmt->rowCount();
133 133
 				$stmt->closeCursor();
134 134
 				return $result;
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	public function getTableFields(string $table): array {
152 152
 		$fqTable = $this->select()->aliasReplacer()->replace($table);
153
-		if(array_key_exists($fqTable, $this->tableFields)) {
153
+		if (array_key_exists($fqTable, $this->tableFields)) {
154 154
 			return $this->tableFields[$fqTable];
155 155
 		}
156 156
 		$query = "DESCRIBE {$fqTable}";
157 157
 		return $this->getQueryLoggers()->logRegion($query, function() use ($query, $fqTable) {
158
-			return $this->exceptionHandler(function () use ($query, $fqTable) {
158
+			return $this->exceptionHandler(function() use ($query, $fqTable) {
159 159
 				$stmt = $this->pdo->query($query);
160 160
 				try {
161
-					if($stmt === false) {
161
+					if ($stmt === false) {
162 162
 						throw new RuntimeException('Invalid return type');
163 163
 					}
164 164
 					$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
165
-					$this->tableFields[$fqTable] = array_map(static function ($row) { return $row['Field']; }, $rows ?: []);
165
+					$this->tableFields[$fqTable] = array_map(static function($row) { return $row['Field']; }, $rows ?: []);
166 166
 					return $this->tableFields[$fqTable];
167 167
 				} finally {
168 168
 					try {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		$select = array_key_exists('select-factory', $this->options)
207 207
 			? call_user_func($this->options['select-factory'], $this, $this->options['select-options'])
208 208
 			: new MySQL\MySQLRunnableSelect($this, $this->options['select-options']);
209
-		if($fields !== null) {
209
+		if ($fields !== null) {
210 210
 			$select->fields($fields);
211 211
 		}
212 212
 		return $select;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		$insert = array_key_exists('insert-factory', $this->options)
221 221
 			? call_user_func($this->options['insert-factory'], $this, $this->options['insert-options'])
222 222
 			: new Builder\RunnableInsert($this, $this->options['insert-options']);
223
-		if($fields !== null) {
223
+		if ($fields !== null) {
224 224
 			$insert->addAll($fields);
225 225
 		}
226 226
 		return $insert;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		$update = array_key_exists('update-factory', $this->options)
235 235
 			? call_user_func($this->options['update-factory'], $this, $this->options['update-options'])
236 236
 			: new Builder\RunnableUpdate($this, $this->options['update-options']);
237
-		if($fields !== null) {
237
+		if ($fields !== null) {
238 238
 			$update->setAll($fields);
239 239
 		}
240 240
 		return $update;
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 * @return $this
254 254
 	 */
255 255
 	public function transactionStart() {
256
-		if($this->transactionLevel === 0) {
257
-			if($this->pdo->inTransaction()) {
256
+		if ($this->transactionLevel === 0) {
257
+			if ($this->pdo->inTransaction()) {
258 258
 				$this->outerTransaction = true;
259 259
 			} else {
260 260
 				$this->pdo->beginTransaction();
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @return $this
269 269
 	 */
270 270
 	public function transactionCommit() {
271
-		return $this->transactionEnd(function () {
271
+		return $this->transactionEnd(function() {
272 272
 			$this->pdo->commit();
273 273
 		});
274 274
 	}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @return $this
278 278
 	 */
279 279
 	public function transactionRollback() {
280
-		return $this->transactionEnd(function () {
280
+		return $this->transactionEnd(function() {
281 281
 			$this->pdo->rollBack();
282 282
 		});
283 283
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 * @return T
289 289
 	 */
290 290
 	public function dryRun(callable $callback) {
291
-		if(!$this->pdo->inTransaction()) {
291
+		if (!$this->pdo->inTransaction()) {
292 292
 			$this->transactionStart();
293 293
 			try {
294 294
 				return $callback($this);
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @throws Throwable
314 314
 	 */
315 315
 	public function transaction(callable $callback) {
316
-		if(!$this->pdo->inTransaction()) {
316
+		if (!$this->pdo->inTransaction()) {
317 317
 			$this->transactionStart();
318 318
 			try {
319 319
 				$result = $callback($this);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 				return $result;
322 322
 			} catch (Throwable $e) {
323 323
 				// @phpstan-ignore-next-line; If condition is always false as it is not.
324
-				if($this->pdo->inTransaction()) {
324
+				if ($this->pdo->inTransaction()) {
325 325
 					$this->transactionRollback();
326 326
 				}
327 327
 				throw $e;
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	private function transactionEnd($fn): self {
347 347
 		$this->transactionLevel--;
348
-		if($this->transactionLevel < 0) {
348
+		if ($this->transactionLevel < 0) {
349 349
 			throw new RuntimeException("Transaction-Nesting-Problem: Trying to invoke commit on a already closed transaction");
350 350
 		}
351
-		if($this->transactionLevel < 1) {
352
-			if($this->outerTransaction) {
351
+		if ($this->transactionLevel < 1) {
352
+			if ($this->outerTransaction) {
353 353
 				$this->outerTransaction = false;
354 354
 			} else {
355 355
 				$fn();
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	private function buildQueryStatement(string $query, callable $fn): QueryStatement {
368 368
 		$stmt = $fn($query);
369
-		if(!$stmt) {
369
+		if (!$stmt) {
370 370
 			throw new RuntimeException("Could not execute statement:\n{$query}");
371 371
 		}
372 372
 		return new QueryStatement($stmt, $query, $this->exceptionInterpreter, $this->queryLoggers);
Please login to merge, or discard this patch.
src/Builder/Internal/ConditionBuilder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 	 * @return string
15 15
 	 */
16 16
 	public static function build(Database $db, string $query, array $conditions, string $token): string {
17
-		if(!count($conditions)) {
17
+		if (!count($conditions)) {
18 18
 			return $query;
19 19
 		}
20 20
 		$query .= "{$token}\n";
21 21
 		$arr = [];
22
-		foreach($conditions as [$expression, $arguments]) {
23
-			if(is_array($expression)) {
24
-				foreach($expression as $key => $value) {
22
+		foreach ($conditions as [$expression, $arguments]) {
23
+			if (is_array($expression)) {
24
+				foreach ($expression as $key => $value) {
25 25
 					$key = self::formatKey($key);
26
-					if($value === null) {
26
+					if ($value === null) {
27 27
 						$arr = self::buildCondition($arr, "ISNULL({$key})", [$value], $db);
28 28
 					} else {
29 29
 						$arr = self::buildCondition($arr, "{$key}=?", [$value], $db);
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 	 * @return string
56 56
 	 */
57 57
 	private static function formatKey(string $key): string {
58
-		if(strpos($key, '`') !== false || strpos($key, '(') !== false) {
58
+		if (strpos($key, '`') !== false || strpos($key, '(') !== false) {
59 59
 			return $key;
60 60
 		}
61 61
 		$keyParts = explode('.', $key);
62
-		$fn = static function (string $part) {
62
+		$fn = static function(string $part) {
63 63
 			return "`{$part}`";
64 64
 		};
65 65
 		$enclosedKeyParts = array_map($fn, $keyParts);
Please login to merge, or discard this patch.
src/Databases/MySQL/MySQLRunnableSelect.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @inheritDoc
87 87
 	 */
88 88
 	public function fetchRowsLazy($callback = null) {
89
-		$callback = $callback ?? (static function ($row) { return $row; });
89
+		$callback = $callback ?? (static function($row) { return $row; });
90 90
 		yield from $this->fetchLazy($callback, PDO::FETCH_ASSOC);
91 91
 	}
92 92
 
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 * @inheritDoc
95 95
 	 */
96 96
 	public function fetchRow($callback = null): array {
97
-		$callback = $callback ?? (static function ($row) { return $row; });
98
-		return $this->fetch($callback, PDO::FETCH_ASSOC, null, static function ($row) {
97
+		$callback = $callback ?? (static function($row) { return $row; });
98
+		return $this->fetch($callback, PDO::FETCH_ASSOC, null, static function($row) {
99 99
 			return ['valid' => is_array($row), 'default' => []];
100 100
 		});
101 101
 	}
@@ -104,17 +104,17 @@  discard block
 block discarded – undo
104 104
 	 * @inheritDoc
105 105
 	 */
106 106
 	public function fetchObjects(string $className = 'stdClass', $callback = null): array {
107
-		return $this->createTempStatement(function (QueryStatement $statement) use ($className, $callback) {
107
+		return $this->createTempStatement(function(QueryStatement $statement) use ($className, $callback) {
108 108
 			$data = $statement->fetchAll(PDO::FETCH_CLASS, $className);
109
-			if($this->preserveTypes) {
109
+			if ($this->preserveTypes) {
110 110
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
111
-				$data = array_map(static function ($row) use ($columnDefinitions) { return FieldValueConverter::convertValues($row, $columnDefinitions); }, $data);
111
+				$data = array_map(static function($row) use ($columnDefinitions) { return FieldValueConverter::convertValues($row, $columnDefinitions); }, $data);
112 112
 			}
113
-			if($callback !== null) {
114
-				return call_user_func(static function ($resultData = []) use ($data, $callback) {
115
-					foreach($data as $row) {
113
+			if ($callback !== null) {
114
+				return call_user_func(static function($resultData = []) use ($data, $callback) {
115
+					foreach ($data as $row) {
116 116
 						$result = $callback($row);
117
-						if($result !== null && !($result instanceof DBIgnoreRow)) {
117
+						if ($result !== null && !($result instanceof DBIgnoreRow)) {
118 118
 							$resultData[] = $result;
119 119
 						} else {
120 120
 							$resultData[] = $row;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @inheritDoc
132 132
 	 */
133 133
 	public function fetchObjectsLazy($className = null, $callback = null) {
134
-		$callback = $callback ?? (static function ($row) { return $row; });
134
+		$callback = $callback ?? (static function($row) { return $row; });
135 135
 		yield from $this->fetchLazy($callback, PDO::FETCH_CLASS, $className ?: $this->defaultClassName);
136 136
 	}
137 137
 
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 * @inheritDoc
140 140
 	 */
141 141
 	public function fetchObject($className = null, $callback = null) {
142
-		$callback = $callback ?? (static function ($row) { return $row; });
143
-		return $this->fetch($callback, PDO::FETCH_CLASS, $className ?: $this->defaultClassName, static function ($row) {
142
+		$callback = $callback ?? (static function($row) { return $row; });
143
+		return $this->fetch($callback, PDO::FETCH_CLASS, $className ?: $this->defaultClassName, static function($row) {
144 144
 			return ['valid' => is_object($row), 'default' => null];
145 145
 		});
146 146
 	}
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 	 * @inheritDoc
150 150
 	 */
151 151
 	public function fetchKeyValue($treatValueAsArray = false): array {
152
-		return $this->createTempStatement(static function (QueryStatement $statement) use ($treatValueAsArray) {
153
-			if($treatValueAsArray) {
152
+		return $this->createTempStatement(static function(QueryStatement $statement) use ($treatValueAsArray) {
153
+			if ($treatValueAsArray) {
154 154
 				$rows = $statement->fetchAll(PDO::FETCH_ASSOC);
155 155
 				$result = [];
156
-				foreach($rows as $row) {
156
+				foreach ($rows as $row) {
157 157
 					[$key] = array_values($row);
158 158
 					$result[$key] = $row;
159 159
 				}
@@ -169,12 +169,12 @@  discard block
 block discarded – undo
169 169
 	public function fetchGroups(array $fields): array {
170 170
 		$rows = $this->fetchRows();
171 171
 		$result = [];
172
-		foreach($rows as $row) {
172
+		foreach ($rows as $row) {
173 173
 			/** @var array<string, mixed> $tmp */
174 174
 			$tmp = &$result;
175
-			foreach($fields as $field) {
175
+			foreach ($fields as $field) {
176 176
 				$value = (string) $row[$field];
177
-				if(!array_key_exists($value, $tmp)) {
177
+				if (!array_key_exists($value, $tmp)) {
178 178
 					$tmp[$value] = [];
179 179
 				}
180 180
 				$tmp = &$tmp[$value];
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 * @inheritDoc
189 189
 	 */
190 190
 	public function fetchArray(?callable $fn = null): array {
191
-		return $this->createTempStatement(static function (QueryStatement $stmt) use ($fn) {
192
-			if($fn !== null) {
191
+		return $this->createTempStatement(static function(QueryStatement $stmt) use ($fn) {
192
+			if ($fn !== null) {
193 193
 				return $stmt->fetchAll(PDO::FETCH_FUNC, $fn);
194 194
 			}
195 195
 			return $stmt->fetchAll(PDO::FETCH_COLUMN);
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @inheritDoc
201 201
 	 */
202 202
 	public function fetchValue($default = null, ?callable $fn = null) {
203
-		return $this->createTempStatement(static function (QueryStatement $stmt) use ($default, $fn) {
203
+		return $this->createTempStatement(static function(QueryStatement $stmt) use ($default, $fn) {
204 204
 			$result = $stmt->fetchAll(PDO::FETCH_COLUMN);
205
-			if($result !== false && array_key_exists(0, $result)) {
205
+			if ($result !== false && array_key_exists(0, $result)) {
206 206
 				return $fn !== null ? $fn($result[0]) : $result[0];
207 207
 			}
208 208
 			return $default;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		$query = $this->__toString();
238 238
 		$statement = $db->prepare($query);
239 239
 		$statement->execute($this->values);
240
-		if($this->getCalcFoundRows()) {
240
+		if ($this->getCalcFoundRows()) {
241 241
 			$this->foundRows = (int) $db->query('SELECT FOUND_ROWS()')->fetchColumn();
242 242
 		}
243 243
 		return $statement;
@@ -259,21 +259,21 @@  discard block
 block discarded – undo
259 259
 	 * @return ($callback is null ? array<int, ($mode is PDO::FETCH_NUM ? array<int, null|scalar> : array<string, null|scalar>)> : array<int, TFnReturnType|TFnParamType>)
260 260
 	 */
261 261
 	private function fetchAll($callback = null, int $mode = 0, $arg0 = null) {
262
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback, $mode, $arg0) {
262
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback, $mode, $arg0) {
263 263
 			$statement->setFetchMode($mode, $arg0);
264 264
 			$data = $statement->fetchAll();
265
-			if($this->preserveTypes) {
265
+			if ($this->preserveTypes) {
266 266
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
267
-				$data = array_map(static function ($row) use ($columnDefinitions) { return FieldValueConverter::convertValues($row, $columnDefinitions); }, $data);
267
+				$data = array_map(static function($row) use ($columnDefinitions) { return FieldValueConverter::convertValues($row, $columnDefinitions); }, $data);
268 268
 			}
269
-			if($callback !== null) {
270
-				return call_user_func(static function ($resultData = []) use ($data, $callback) {
271
-					foreach($data as $row) {
269
+			if ($callback !== null) {
270
+				return call_user_func(static function($resultData = []) use ($data, $callback) {
271
+					foreach ($data as $row) {
272 272
 						$result = $callback($row);
273
-						if($result instanceof DBIgnoreRow) {
273
+						if ($result instanceof DBIgnoreRow) {
274 274
 							continue;
275 275
 						}
276
-						if($result !== null) {
276
+						if ($result !== null) {
277 277
 							$resultData[] = $result;
278 278
 						} else {
279 279
 							$resultData[] = $row;
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
 		$statement = $this->createStatement();
299 299
 		$statement->setFetchMode($mode, $arg0);
300 300
 		try {
301
-			while($row = $statement->fetch()) {
301
+			while ($row = $statement->fetch()) {
302 302
 				/** @var T $row */
303 303
 //				if($this->preserveTypes) {
304 304
 //					$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
305 305
 //					$row = FieldValueConverter::convertValues($row, $columnDefinitions);
306 306
 //				}
307 307
 				$result = $callback($row);
308
-				if($result instanceof DBIgnoreRow) {
308
+				if ($result instanceof DBIgnoreRow) {
309 309
 					// Skip row in this case
310 310
 					continue;
311 311
 				}
312
-				if($result !== null) {
312
+				if ($result !== null) {
313 313
 					yield $result;
314 314
 				} else {
315 315
 					yield $row;
@@ -330,20 +330,20 @@  discard block
 block discarded – undo
330 330
 	 * @return T|U|array<string, mixed>
331 331
 	 */
332 332
 	private function fetch($callback, int $mode = PDO::FETCH_ASSOC, $arg0 = null, Closure $resultValidator = null) {
333
-		return $this->createTempStatement(function (QueryStatement $statement) use ($callback, $mode, $arg0, $resultValidator) {
333
+		return $this->createTempStatement(function(QueryStatement $statement) use ($callback, $mode, $arg0, $resultValidator) {
334 334
 			$statement->setFetchMode($mode, $arg0);
335 335
 			$row = $statement->fetch();
336 336
 			$result = $resultValidator === null ? ['valid' => true] : $resultValidator($row);
337
-			if(!$result['valid']) {
337
+			if (!$result['valid']) {
338 338
 				return $result['default'];
339 339
 			}
340
-			if($this->preserveTypes) {
340
+			if ($this->preserveTypes) {
341 341
 				$columnDefinitions = FieldTypeProvider::getFieldTypes($statement);
342 342
 				$row = FieldValueConverter::convertValues($row, $columnDefinitions);
343 343
 			}
344
-			if($callback !== null) {
344
+			if ($callback !== null) {
345 345
 				$result = $callback($row);
346
-				if($result !== null) {
346
+				if ($result !== null) {
347 347
 					$row = $result;
348 348
 				}
349 349
 			}
Please login to merge, or discard this patch.
src/Builder/QueryStatement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.