@@ -15,10 +15,10 @@ |
||
| 15 | 15 | use BenTools\SimpleDBAL\Model\Exception\ParamBindingException; |
| 16 | 16 | use GuzzleHttp\Promise\Promise; |
| 17 | 17 | use GuzzleHttp\Promise\PromiseInterface; |
| 18 | +use Throwable; |
|
| 18 | 19 | use mysqli; |
| 19 | 20 | use mysqli_result; |
| 20 | 21 | use mysqli_sql_exception; |
| 21 | -use Throwable; |
|
| 22 | 22 | |
| 23 | 23 | final class MysqliAdapter implements AdapterInterface, TransactionAdapterInterface, ReconnectableAdapterInterface |
| 24 | 24 | { |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | try { |
| 149 | 149 | $wrappedStmt = self::wrapWithErrorHandler( |
| 150 | - function () use ($runnableQueryString) { |
|
| 150 | + function() use ($runnableQueryString) { |
|
| 151 | 151 | return $this->cnx->prepare($runnableQueryString); |
| 152 | 152 | } |
| 153 | 153 | ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $promise = new Promise( |
| 218 | - function () use (&$promise, $stmt, $values) { |
|
| 218 | + function() use (&$promise, $stmt, $values) { |
|
| 219 | 219 | try { |
| 220 | 220 | $promise->resolve($this->execute($stmt, $values)); |
| 221 | 221 | } catch (Throwable $e) { |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $query = $stmt instanceof EmulatedStatement ? $stmt->getRunnableQuery() : $stmt; |
| 268 | 268 | |
| 269 | 269 | return MysqliAsync::query($query, $cnx)->then( |
| 270 | - static function ($result) use ($cnx) { |
|
| 270 | + static function($result) use ($cnx) { |
|
| 271 | 271 | if (!$result instanceof mysqli_result) { |
| 272 | 272 | $result = null; |
| 273 | 273 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | try { |
| 283 | 283 | return self::wrapWithErrorHandler( |
| 284 | - static function () use ($stmt) { |
|
| 284 | + static function() use ($stmt) { |
|
| 285 | 285 | return $stmt->createResult(); |
| 286 | 286 | } |
| 287 | 287 | ); |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | private static function wrapWithErrorHandler(callable $run) |
| 400 | 400 | { |
| 401 | - $errorHandler = static function ($errno, $errstr) { |
|
| 401 | + $errorHandler = static function($errno, $errstr) { |
|
| 402 | 402 | throw new mysqli_sql_exception($errstr, $errno); |
| 403 | 403 | }; |
| 404 | 404 | set_error_handler($errorHandler, E_WARNING); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | $this->credentials = $credentials; |
| 54 | 54 | if (null !== $options) { |
| 55 | - $this->options = array_replace($this->getDefaultOptions(), $options); |
|
| 55 | + $this->options = array_replace($this->getDefaultOptions(), $options); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function isConnected(): bool |
| 79 | 79 | { |
| 80 | 80 | try { |
| 81 | - self::wrapWithErrorHandler(function () { |
|
| 81 | + self::wrapWithErrorHandler(function() { |
|
| 82 | 82 | $this->cnx->getAttribute(PDO::ATTR_SERVER_INFO); |
| 83 | 83 | }); |
| 84 | 84 | return true; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function executeAsync($stmt, array $values = null): PromiseInterface |
| 176 | 176 | { |
| 177 | - $promise = new Promise(function () use (&$promise, $stmt, $values) { |
|
| 177 | + $promise = new Promise(function() use (&$promise, $stmt, $values) { |
|
| 178 | 178 | try { |
| 179 | 179 | $promise->resolve($this->execute($stmt, $values)); |
| 180 | 180 | } catch (DBALException $e) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | $wrappedStmt = $stmt->getWrappedStatement(); |
| 190 | 190 | try { |
| 191 | - self::wrapWithErrorHandler(function () use ($stmt, $wrappedStmt) { |
|
| 191 | + self::wrapWithErrorHandler(function() use ($stmt, $wrappedStmt) { |
|
| 192 | 192 | $stmt->bind(); |
| 193 | 193 | $wrappedStmt->execute(); |
| 194 | 194 | }); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | private static function wrapWithErrorHandler(callable $run) |
| 291 | 291 | { |
| 292 | - $errorHandler = static function ($errno, $errstr) { |
|
| 292 | + $errorHandler = static function($errno, $errstr) { |
|
| 293 | 293 | throw new PDOException($errstr, $errno); |
| 294 | 294 | }; |
| 295 | 295 | set_error_handler($errorHandler, E_WARNING); |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | |
| 84 | 84 | $this->freeze(); |
| 85 | 85 | |
| 86 | - $generator = static function (PDOStatement $stmt) { |
|
| 86 | + $generator = static function(PDOStatement $stmt) { |
|
| 87 | 87 | while (false !== ($value = $stmt->fetchColumn(0))) { |
| 88 | 88 | yield $value; |
| 89 | 89 | } |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | |
| 89 | 89 | $this->freeze(); |
| 90 | 90 | |
| 91 | - $generator = function (mysqli_result $result) { |
|
| 91 | + $generator = function(mysqli_result $result) { |
|
| 92 | 92 | while (null !== ($row = $result->fetch_array(MYSQLI_NUM))) { |
| 93 | 93 | yield $row[0]; |
| 94 | 94 | } |