@@ -73,7 +73,7 @@ |
||
| 73 | 73 | { |
| 74 | 74 | return preg_replace_callback( |
| 75 | 75 | '/({{(%?[\w\-. ]+%?)}}|\\[\\[([\w\-. ]+)]])/', |
| 76 | - function ($matches) { |
|
| 76 | + function($matches) { |
|
| 77 | 77 | if (isset($matches[3])) { |
| 78 | 78 | return $this->quoteColumnName($matches[3]); |
| 79 | 79 | } |
@@ -102,14 +102,14 @@ |
||
| 102 | 102 | public function unquoteSimpleColumnName(string $name): string; |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * Unquotes a simple table name. |
|
| 106 | - * |
|
| 107 | - * A simple table name should contain the table name only without any schema prefix. If the table name is not |
|
| 108 | - * quoted, this method will do nothing. |
|
| 109 | - * |
|
| 110 | - * @param string $name table name. |
|
| 111 | - * |
|
| 112 | - * @return string unquoted table name. |
|
| 113 | - */ |
|
| 105 | + * Unquotes a simple table name. |
|
| 106 | + * |
|
| 107 | + * A simple table name should contain the table name only without any schema prefix. If the table name is not |
|
| 108 | + * quoted, this method will do nothing. |
|
| 109 | + * |
|
| 110 | + * @param string $name table name. |
|
| 111 | + * |
|
| 112 | + * @return string unquoted table name. |
|
| 113 | + */ |
|
| 114 | 114 | public function unquoteSimpleTableName(string $name): string; |
| 115 | 115 | } |
@@ -497,7 +497,7 @@ |
||
| 497 | 497 | string $name, |
| 498 | 498 | bool $refresh = false |
| 499 | 499 | ): Constraint|array|null|TableSchema { |
| 500 | - return match ($type) { |
|
| 500 | + return match($type) { |
|
| 501 | 501 | self::SCHEMA => $this->getTableSchema($name, $refresh), |
| 502 | 502 | self::PRIMARY_KEY => $this->getTablePrimaryKey($name, $refresh), |
| 503 | 503 | self::UNIQUES => $this->getTableUniques($name, $refresh), |
@@ -576,13 +576,13 @@ |
||
| 576 | 576 | public function dropCommentFromColumn(string $table, string $column): string; |
| 577 | 577 | |
| 578 | 578 | /** |
| 579 | - * Builds a SQL command for adding comment to table. |
|
| 580 | - * |
|
| 581 | - * @param string $table the table whose column is to be commented. The table name will be properly quoted by the |
|
| 582 | - * method. |
|
| 583 | - * |
|
| 584 | - * @return string the SQL statement for adding comment on column. |
|
| 585 | - */ |
|
| 579 | + * Builds a SQL command for adding comment to table. |
|
| 580 | + * |
|
| 581 | + * @param string $table the table whose column is to be commented. The table name will be properly quoted by the |
|
| 582 | + * method. |
|
| 583 | + * |
|
| 584 | + * @return string the SQL statement for adding comment on column. |
|
| 585 | + */ |
|
| 586 | 586 | public function dropCommentFromTable(string $table): string; |
| 587 | 587 | |
| 588 | 588 | /** |
@@ -203,8 +203,8 @@ |
||
| 203 | 203 | public function dropCommentFromTable(string $table): string |
| 204 | 204 | { |
| 205 | 205 | return 'COMMENT ON TABLE ' |
| 206 | - . $this->queryBuilder->quoter()->quoteTableName($table) |
|
| 207 | - . ' IS NULL'; |
|
| 206 | + . $this->queryBuilder->quoter()->quoteTableName($table) |
|
| 207 | + . ' IS NULL'; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | public function dropDefaultValue(string $name, string $table): string |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | */ |
| 855 | 855 | protected function hasOffset(mixed $offset): bool |
| 856 | 856 | { |
| 857 | - return ($offset instanceof ExpressionInterface) || (ctype_digit((string)$offset) && (string)$offset !== '0'); |
|
| 857 | + return ($offset instanceof ExpressionInterface) || (ctype_digit((string) $offset) && (string) $offset !== '0'); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | /** Remove duplicates */ |
| 1047 | 1047 | $constraints = array_combine( |
| 1048 | 1048 | array_map( |
| 1049 | - static function ($constraint) { |
|
| 1049 | + static function($constraint) { |
|
| 1050 | 1050 | $columns = $constraint->getColumnNames(); |
| 1051 | 1051 | sort($columns, SORT_STRING); |
| 1052 | 1052 | |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | $constraints = array_values( |
| 1065 | 1065 | array_filter( |
| 1066 | 1066 | $constraints, |
| 1067 | - static function ($constraint) use ($quoter, $columns, &$columnNames) { |
|
| 1067 | + static function($constraint) use ($quoter, $columns, &$columnNames) { |
|
| 1068 | 1068 | /** @psalm-suppress UndefinedClass, UndefinedMethod */ |
| 1069 | 1069 | $constraintColumnNames = array_map([$quoter, 'quoteColumnName'], $constraint->getColumnNames()); |
| 1070 | 1070 | $result = !array_diff($constraintColumnNames, $columns); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | ): mixed { |
| 43 | 43 | return $this->cache->getOrSet( |
| 44 | 44 | $key, |
| 45 | - static fn () => $value, |
|
| 45 | + static fn() => $value, |
|
| 46 | 46 | $ttl, |
| 47 | 47 | $dependency, |
| 48 | 48 | ); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | public function batchInsert(string $table, array $columns, iterable $rows): self |
| 218 | 218 | { |
| 219 | 219 | $table = $this->queryBuilder()->quoter()->quoteSql($table); |
| 220 | - $columns = array_map(fn ($column) => $this->queryBuilder()->quoter()->quoteSql($column), $columns); |
|
| 220 | + $columns = array_map(fn($column) => $this->queryBuilder()->quoter()->quoteSql($column), $columns); |
|
| 221 | 221 | $params = []; |
| 222 | 222 | $sql = $this->queryBuilder()->batchInsert($table, $columns, $rows, $params); |
| 223 | 223 | |
@@ -432,18 +432,18 @@ discard block |
||
| 432 | 432 | $this->prepare(false); |
| 433 | 433 | |
| 434 | 434 | try { |
| 435 | - $this->profiler?->begin((string)$rawSql, [__METHOD__]); |
|
| 435 | + $this->profiler ? ->begin((string) $rawSql, [__METHOD__]); |
|
| 436 | 436 | |
| 437 | 437 | $this->internalExecute($rawSql); |
| 438 | 438 | $n = $this->pdoStatement->rowCount(); |
| 439 | 439 | |
| 440 | - $this->profiler?->end((string)$rawSql, [__METHOD__]); |
|
| 440 | + $this->profiler ? ->end((string) $rawSql, [__METHOD__]); |
|
| 441 | 441 | |
| 442 | 442 | $this->refreshTableSchema(); |
| 443 | 443 | |
| 444 | 444 | return $n; |
| 445 | 445 | } catch (Exception $e) { |
| 446 | - $this->profiler?->end((string)$rawSql, [__METHOD__]); |
|
| 446 | + $this->profiler ? ->end((string) $rawSql, [__METHOD__]); |
|
| 447 | 447 | throw $e; |
| 448 | 448 | } |
| 449 | 449 | } |
@@ -708,11 +708,11 @@ discard block |
||
| 708 | 708 | $cacheKey = $this->getCacheKey($method, $fetchMode, $rawSql); |
| 709 | 709 | $result = $cache->getOrSet( |
| 710 | 710 | $cacheKey, |
| 711 | - static fn () => null, |
|
| 711 | + static fn() => null, |
|
| 712 | 712 | ); |
| 713 | 713 | |
| 714 | 714 | if (is_array($result) && isset($result[0])) { |
| 715 | - $this->logger?->log(LogLevel::DEBUG, 'Query result served from cache', [__CLASS__ . '::query']); |
|
| 715 | + $this->logger ? ->log(LogLevel::DEBUG, 'Query result served from cache', [__CLASS__ . '::query']); |
|
| 716 | 716 | |
| 717 | 717 | return $result[0]; |
| 718 | 718 | } |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | $this->prepare(true); |
| 723 | 723 | |
| 724 | 724 | try { |
| 725 | - $this->profiler?->begin((string)$rawSql, [__CLASS__ . '::query']); |
|
| 725 | + $this->profiler ? ->begin((string) $rawSql, [__CLASS__ . '::query']); |
|
| 726 | 726 | |
| 727 | 727 | $this->internalExecute($rawSql); |
| 728 | 728 | |
@@ -738,21 +738,21 @@ discard block |
||
| 738 | 738 | $this->pdoStatement->closeCursor(); |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - $this->profiler?->end((string)$rawSql, [__CLASS__ . '::query']); |
|
| 741 | + $this->profiler ? ->end((string) $rawSql, [__CLASS__ . '::query']); |
|
| 742 | 742 | } catch (Exception $e) { |
| 743 | - $this->profiler?->end((string)$rawSql, [__CLASS__ . '::query']); |
|
| 743 | + $this->profiler ? ->end((string) $rawSql, [__CLASS__ . '::query']); |
|
| 744 | 744 | throw $e; |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | if (isset($cache, $cacheKey, $info)) { |
| 748 | 748 | $cache->getOrSet( |
| 749 | 749 | $cacheKey, |
| 750 | - static fn (): array => [$result], |
|
| 750 | + static fn(): array => [$result], |
|
| 751 | 751 | $info[1], |
| 752 | 752 | $info[2] |
| 753 | 753 | ); |
| 754 | 754 | |
| 755 | - $this->logger?->log(LogLevel::DEBUG, 'Saved query result in cache', [__CLASS__ . '::query']); |
|
| 755 | + $this->logger ? ->log(LogLevel::DEBUG, 'Saved query result in cache', [__CLASS__ . '::query']); |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | return $result; |
@@ -262,7 +262,7 @@ |
||
| 262 | 262 | |
| 263 | 263 | return $poolConnection; |
| 264 | 264 | } catch (Exception $e) { |
| 265 | - $this->logger?->log( |
|
| 265 | + $this->logger ? ->log( |
|
| 266 | 266 | LogLevel::WARNING, |
| 267 | 267 | "Connection ({$poolConnection->getDriver()->getDsn()}) failed: " . $e->getMessage() . ' ' . __METHOD__ |
| 268 | 268 | ); |