@@ -8,6 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | /** |
| 10 | 10 | * @inheritDoc |
| 11 | + * @param string $queryString |
|
| 11 | 12 | */ |
| 12 | 13 | public function __construct(MysqliAdapter $connection, array $values = null, $queryString) |
| 13 | 14 | { |
@@ -163,7 +163,7 @@ |
||
| 163 | 163 | return $this->queryString; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $escape = function ($value) { |
|
| 166 | + $escape = function($value) { |
|
| 167 | 167 | if (null === $value) { |
| 168 | 168 | return 'NULL'; |
| 169 | 169 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function query(string $query, mysqli $cnx) |
| 34 | 34 | { |
| 35 | - $promise = new Promise(function () { |
|
| 35 | + $promise = new Promise(function() { |
|
| 36 | 36 | self::getInstance()->wait(); |
| 37 | 37 | }); |
| 38 | 38 | $cnx->query($query, MYSQLI_ASYNC); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | foreach ($this->queries as $l => $link) { |
| 120 | 120 | $promise = $this->getPromise($link); |
| 121 | - $cnx = $this->getConnection($link); |
|
| 121 | + $cnx = $this->getConnection($link); |
|
| 122 | 122 | try { |
| 123 | 123 | $result = $cnx->reap_async_query(); |
| 124 | 124 | if ($result instanceof mysqli_result) { |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | return $this->stmt->queryString; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $escape = function ($value) { |
|
| 159 | + $escape = function($value) { |
|
| 160 | 160 | if (null === $value) { |
| 161 | 161 | return 'NULL'; |
| 162 | 162 | } |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | namespace BenTools\SimpleDBAL\Model\Adapter\PDO; |
| 4 | 4 | |
| 5 | 5 | use BenTools\SimpleDBAL\Contract\AdapterInterface; |
| 6 | -use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 7 | 6 | use BenTools\SimpleDBAL\Contract\ResultInterface; |
| 7 | +use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 8 | 8 | use BenTools\SimpleDBAL\Model\StatementTrait; |
| 9 | 9 | use PDO; |
| 10 | 10 | use PDOStatement; |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | use BenTools\SimpleDBAL\Contract\AdapterInterface; |
| 6 | 6 | use BenTools\SimpleDBAL\Contract\CredentialsInterface; |
| 7 | 7 | use BenTools\SimpleDBAL\Contract\ReconnectableAdapterInterface; |
| 8 | -use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 9 | 8 | use BenTools\SimpleDBAL\Contract\ResultInterface; |
| 9 | +use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 10 | 10 | use BenTools\SimpleDBAL\Contract\TransactionAdapterInterface; |
| 11 | 11 | use BenTools\SimpleDBAL\Model\ConfigurableTrait; |
| 12 | 12 | use BenTools\SimpleDBAL\Model\Exception\AccessDeniedException; |
@@ -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); |
@@ -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); |
@@ -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 | } |