@@ -16,7 +16,7 @@ |
||
| 16 | 16 | \Spiral\Database\Driver\SQLServer\Schema\SQlServerForeignKey::class, |
| 17 | 17 | ); |
| 18 | 18 | |
| 19 | -spl_autoload_register(static function (string $class): void { |
|
| 19 | +spl_autoload_register(static function(string $class): void { |
|
| 20 | 20 | if (strpos($class, 'Spiral\\Database\\') === 0) { |
| 21 | 21 | $original = 'Cycle\\Database\\' . substr($class, 16); |
| 22 | 22 | |
@@ -222,7 +222,7 @@ |
||
| 222 | 222 | //Fetching enum values |
| 223 | 223 | if ($options !== [] && $column->getAbstractType() === 'enum') { |
| 224 | 224 | $column->enumValues = array_map( |
| 225 | - static function ($value) { |
|
| 225 | + static function($value) { |
|
| 226 | 226 | return trim($value, $value[0]); |
| 227 | 227 | }, |
| 228 | 228 | $options |
@@ -106,8 +106,8 @@ |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $this->primaryKeys[$name] = $this->getSchemaHandler() |
| 109 | - ->getSchema($table, $prefix) |
|
| 110 | - ->getPrimaryKeys(); |
|
| 109 | + ->getSchema($table, $prefix) |
|
| 110 | + ->getPrimaryKeys(); |
|
| 111 | 111 | |
| 112 | 112 | if (count($this->primaryKeys[$name]) === 1) { |
| 113 | 113 | //We do support only single primary key |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | ++$this->transactionLevel; |
| 143 | 143 | |
| 144 | 144 | if ($this->transactionLevel === 1) { |
| 145 | - $this->logger?->info('Begin transaction'); |
|
| 145 | + $this->logger ? ->info('Begin transaction'); |
|
| 146 | 146 | |
| 147 | 147 | try { |
| 148 | 148 | $ok = $this->getPDO()->beginTransaction(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function withDriver(DriverInterface $driver, string $prefix = null): QueryInterface |
| 36 | 36 | { |
| 37 | - if (! $driver instanceof PostgresDriver) { |
|
| 37 | + if (!$driver instanceof PostgresDriver) { |
|
| 38 | 38 | throw new BuilderException( |
| 39 | 39 | 'Postgres InsertQuery can be used only with Postgres driver' |
| 40 | 40 | ); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | /** |
| 47 | 47 | * Set returning column. If not set, the driver will detect PK automatically. |
| 48 | 48 | */ |
| 49 | - public function returning(string|FragmentInterface ...$columns): self |
|
| 49 | + public function returning(string | FragmentInterface ...$columns): self |
|
| 50 | 50 | { |
| 51 | 51 | if ($columns === []) { |
| 52 | 52 | throw new BuilderException( |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function __call(string $name, array $arguments): mixed |
| 125 | 125 | { |
| 126 | - return match ($name) { |
|
| 126 | + return match($name) { |
|
| 127 | 127 | 'isProfiling' => true, |
| 128 | 128 | 'setProfiling' => null, |
| 129 | 129 | 'getSchema' => $this->getSchemaHandler()->getSchema( |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $this->pdo = null; |
| 230 | 230 | } catch (Throwable $e) { |
| 231 | 231 | // disconnect error |
| 232 | - $this->logger?->error($e->getMessage()); |
|
| 232 | + $this->logger ? ->error($e->getMessage()); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $this->transactionLevel = 0; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | public function lastInsertID(string $sequence = null) |
| 291 | 291 | { |
| 292 | 292 | $result = $this->getPDO()->lastInsertId(); |
| 293 | - $this->logger?->debug("Insert ID: {$result}"); |
|
| 293 | + $this->logger ? ->debug("Insert ID: {$result}"); |
|
| 294 | 294 | |
| 295 | 295 | return $result; |
| 296 | 296 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $this->setIsolationLevel($isolationLevel); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - $this->logger?->info('Begin transaction'); |
|
| 317 | + $this->logger ? ->info('Begin transaction'); |
|
| 318 | 318 | |
| 319 | 319 | try { |
| 320 | 320 | return $this->getPDO()->beginTransaction(); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | { |
| 357 | 357 | // Check active transaction |
| 358 | 358 | if (!$this->getPDO()->inTransaction()) { |
| 359 | - $this->logger?->warning( |
|
| 359 | + $this->logger ? ->warning( |
|
| 360 | 360 | sprintf( |
| 361 | 361 | 'Attempt to commit a transaction that has not yet begun. Transaction level: %d', |
| 362 | 362 | $this->transactionLevel |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | --$this->transactionLevel; |
| 375 | 375 | |
| 376 | 376 | if ($this->transactionLevel === 0) { |
| 377 | - $this->logger?->info('Commit transaction'); |
|
| 377 | + $this->logger ? ->info('Commit transaction'); |
|
| 378 | 378 | |
| 379 | 379 | try { |
| 380 | 380 | return $this->getPDO()->commit(); |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | { |
| 400 | 400 | // Check active transaction |
| 401 | 401 | if (!$this->getPDO()->inTransaction()) { |
| 402 | - $this->logger?->warning( |
|
| 402 | + $this->logger ? ->warning( |
|
| 403 | 403 | sprintf( |
| 404 | 404 | 'Attempt to rollback a transaction that has not yet begun. Transaction level: %d', |
| 405 | 405 | $this->transactionLevel |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | --$this->transactionLevel; |
| 414 | 414 | |
| 415 | 415 | if ($this->transactionLevel === 0) { |
| 416 | - $this->logger?->info('Rollback transaction'); |
|
| 416 | + $this->logger ? ->info('Rollback transaction'); |
|
| 417 | 417 | |
| 418 | 418 | try { |
| 419 | 419 | return $this->getPDO()->rollBack(); |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | */ |
| 578 | 578 | protected function setIsolationLevel(string $level): void |
| 579 | 579 | { |
| 580 | - $this->logger?->info("Transaction isolation level '{$level}'"); |
|
| 580 | + $this->logger ? ->info("Transaction isolation level '{$level}'"); |
|
| 581 | 581 | $this->execute("SET TRANSACTION ISOLATION LEVEL {$level}"); |
| 582 | 582 | } |
| 583 | 583 | |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | */ |
| 591 | 591 | protected function createSavepoint(int $level): void |
| 592 | 592 | { |
| 593 | - $this->logger?->info("Transaction: new savepoint 'SVP{$level}'"); |
|
| 593 | + $this->logger ? ->info("Transaction: new savepoint 'SVP{$level}'"); |
|
| 594 | 594 | |
| 595 | 595 | $this->execute('SAVEPOINT ' . $this->identifier("SVP{$level}")); |
| 596 | 596 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | */ |
| 605 | 605 | protected function releaseSavepoint(int $level): void |
| 606 | 606 | { |
| 607 | - $this->logger?->info("Transaction: release savepoint 'SVP{$level}'"); |
|
| 607 | + $this->logger ? ->info("Transaction: release savepoint 'SVP{$level}'"); |
|
| 608 | 608 | |
| 609 | 609 | $this->execute('RELEASE SAVEPOINT ' . $this->identifier("SVP{$level}")); |
| 610 | 610 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | */ |
| 619 | 619 | protected function rollbackSavepoint(int $level): void |
| 620 | 620 | { |
| 621 | - $this->logger?->info("Transaction: rollback savepoint 'SVP{$level}'"); |
|
| 621 | + $this->logger ? ->info("Transaction: rollback savepoint 'SVP{$level}'"); |
|
| 622 | 622 | |
| 623 | 623 | $this->execute('ROLLBACK TO SAVEPOINT ' . $this->identifier("SVP{$level}")); |
| 624 | 624 | } |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | { |
| 633 | 633 | $connection = $this->config->connection; |
| 634 | 634 | |
| 635 | - if (! $connection instanceof PDOConnectionConfig) { |
|
| 635 | + if (!$connection instanceof PDOConnectionConfig) { |
|
| 636 | 636 | throw new \InvalidArgumentException( |
| 637 | 637 | 'Could not establish PDO connection using non-PDO configuration' |
| 638 | 638 | ); |
@@ -315,7 +315,7 @@ |
||
| 315 | 315 | } |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $hash .= (string) $column . ','; |
|
| 318 | + $hash .= (string)$column . ','; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | return $hash; |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | { |
| 153 | 153 | return preg_replace_callback( |
| 154 | 154 | '/([a-z][0-9_a-z\.]*\(?)/i', |
| 155 | - function ($match) { |
|
| 155 | + function($match) { |
|
| 156 | 156 | $identifier = $match[1]; |
| 157 | 157 | |
| 158 | 158 | //Function name |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | protected function setIsolationLevel(string $level): void |
| 46 | 46 | { |
| 47 | - $this->logger?->alert("Transaction isolation level is not fully supported by SQLite ({$level})"); |
|
| 47 | + $this->logger ? ->alert("Transaction isolation level is not fully supported by SQLite ({$level})"); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | $result = []; |
| 311 | 311 | foreach ($groupBy as $identifier) { |
| 312 | - $result[] = $this->name($params, $q, $identifier); |
|
| 312 | + $result[] = $this->name($params, $q, $identifier); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | return implode(', ', $result); |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | { |
| 410 | 410 | // let's quote every identifier |
| 411 | 411 | $columns = array_map( |
| 412 | - function ($column) use ($params, $q) { |
|
| 412 | + function($column) use ($params, $q) { |
|
| 413 | 413 | return $this->name($params, $q, $column); |
| 414 | 414 | }, |
| 415 | 415 | $columns |