@@ -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 | |
@@ -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(); |
@@ -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 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function createSavepoint(int $level): void |
| 97 | 97 | { |
| 98 | - $this->logger?->info("Transaction: new savepoint 'SVP{$level}'"); |
|
| 98 | + $this->logger ? ->info("Transaction: new savepoint 'SVP{$level}'"); |
|
| 99 | 99 | |
| 100 | 100 | $this->execute('SAVE TRANSACTION ' . $this->identifier("SVP{$level}")); |
| 101 | 101 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | protected function releaseSavepoint(int $level): void |
| 111 | 111 | { |
| 112 | - $this->logger?->info("Transaction: release savepoint 'SVP{$level}'"); |
|
| 112 | + $this->logger ? ->info("Transaction: release savepoint 'SVP{$level}'"); |
|
| 113 | 113 | |
| 114 | 114 | // SQLServer automatically commits nested transactions with parent transaction |
| 115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected function rollbackSavepoint(int $level): void |
| 125 | 125 | { |
| 126 | - $this->logger?->info("Transaction: rollback savepoint 'SVP{$level}'"); |
|
| 126 | + $this->logger ? ->info("Transaction: rollback savepoint 'SVP{$level}'"); |
|
| 127 | 127 | |
| 128 | 128 | $this->execute('ROLLBACK TRANSACTION ' . $this->identifier("SVP{$level}")); |
| 129 | 129 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | QueryBuilder::defaultBuilder() |
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | - if ((int) $driver->getPDO()->getAttribute(\PDO::ATTR_SERVER_VERSION) < 12) { |
|
| 170 | + if ((int)$driver->getPDO()->getAttribute(\PDO::ATTR_SERVER_VERSION) < 12) { |
|
| 171 | 171 | throw new DriverException('SQLServer driver supports only 12+ version of SQLServer'); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -11,5 +11,5 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * Set returning column or expression. |
| 13 | 13 | */ |
| 14 | - public function returning(string|FragmentInterface ...$columns): self; |
|
| 14 | + public function returning(string | FragmentInterface ...$columns): self; |
|
| 15 | 15 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @param array $options |
| 35 | 35 | */ |
| 36 | 36 | public function __construct( |
| 37 | - string|\Stringable $dsn, |
|
| 37 | + string | \Stringable $dsn, |
|
| 38 | 38 | ?string $user = null, |
| 39 | 39 | ?string $password = null, |
| 40 | 40 | array $options = [] |