@@ -100,7 +100,7 @@ |
||
| 100 | 100 | */ |
| 101 | 101 | private function havingWrapper(): Closure |
| 102 | 102 | { |
| 103 | - return static function ($parameter) { |
|
| 103 | + return static function($parameter) { |
|
| 104 | 104 | \is_array($parameter) and throw new BuilderException('Arrays must be wrapped with Parameter instance'); |
| 105 | 105 | |
| 106 | 106 | return !$parameter instanceof ParameterInterface && !$parameter instanceof FragmentInterface |
@@ -228,7 +228,7 @@ |
||
| 228 | 228 | * |
| 229 | 229 | * @psalm-return non-empty-string |
| 230 | 230 | */ |
| 231 | - protected function identify(AbstractTable|ElementInterface|string $element): string |
|
| 231 | + protected function identify(AbstractTable | ElementInterface | string $element): string |
|
| 232 | 232 | { |
| 233 | 233 | if (\is_string($element)) { |
| 234 | 234 | return $this->driver->identifier($element); |
@@ -322,7 +322,7 @@ |
||
| 322 | 322 | { |
| 323 | 323 | $defaultValue = parent::quoteDefault($driver); |
| 324 | 324 | if ($this->getAbstractType() === 'boolean') { |
| 325 | - $defaultValue = (string) ((int)$this->defaultValue); |
|
| 325 | + $defaultValue = (string)((int)$this->defaultValue); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | return $defaultValue; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | foreach ($schema as $indexColumn) { |
| 28 | 28 | $index->columns[] = $indexColumn['columnName']; |
| 29 | - if ((int) $indexColumn['isDescendingKey'] === 1) { |
|
| 29 | + if ((int)$indexColumn['isDescendingKey'] === 1) { |
|
| 30 | 30 | $index->sort[$indexColumn['columnName']] = 'DESC'; |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | ); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - protected function distinct(QueryParameters $params, Quoter $q, string|bool|array $distinct): string |
|
| 43 | + protected function distinct(QueryParameters $params, Quoter $q, string | bool | array $distinct): string |
|
| 44 | 44 | { |
| 45 | 45 | if ($distinct === false) { |
| 46 | 46 | return ''; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** |
| 20 | 20 | * Apply distinct ON to the query. |
| 21 | 21 | */ |
| 22 | - public function distinctOn(FragmentInterface|string $distinctOn): SelectQuery |
|
| 22 | + public function distinctOn(FragmentInterface | string $distinctOn): SelectQuery |
|
| 23 | 23 | { |
| 24 | 24 | $this->distinct = ['on' => $distinctOn]; |
| 25 | 25 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * Set returning column. If not set, the driver will detect PK automatically. |
| 46 | 46 | */ |
| 47 | - public function returning(string|FragmentInterface ...$columns): self |
|
| 47 | + public function returning(string | FragmentInterface ...$columns): self |
|
| 48 | 48 | { |
| 49 | 49 | $columns === [] and throw new BuilderException('RETURNING clause should contain at least 1 column.'); |
| 50 | 50 | |
@@ -333,11 +333,11 @@ discard block |
||
| 333 | 333 | return $this->formatDatetime($this->getAbstractType(), $this->defaultValue); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - return match ($this->getType()) { |
|
| 337 | - 'int' => (int) $this->defaultValue, |
|
| 338 | - 'float' => (float) $this->defaultValue, |
|
| 336 | + return match($this->getType()) { |
|
| 337 | + 'int' => (int)$this->defaultValue, |
|
| 338 | + 'float' => (float)$this->defaultValue, |
|
| 339 | 339 | 'bool' => \is_string($this->defaultValue) && strtolower($this->defaultValue) === 'false' |
| 340 | - ? false : (bool) $this->defaultValue, |
|
| 340 | + ? false : (bool)$this->defaultValue, |
|
| 341 | 341 | default => (string)$this->defaultValue |
| 342 | 342 | }; |
| 343 | 343 | } |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | * |
| 507 | 507 | * @param array|string $values Enum values (array or comma separated). String values only. |
| 508 | 508 | */ |
| 509 | - public function enum(string|array $values): self |
|
| 509 | + public function enum(string | array $values): self |
|
| 510 | 510 | { |
| 511 | 511 | $this->type('enum'); |
| 512 | 512 | $this->enumValues = array_map( |
@@ -654,10 +654,10 @@ discard block |
||
| 654 | 654 | ); |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | - return match ($this->getType()) { |
|
| 657 | + return match($this->getType()) { |
|
| 658 | 658 | 'bool' => $defaultValue ? 'TRUE' : 'FALSE', |
| 659 | 659 | 'float' => sprintf('%F', $defaultValue), |
| 660 | - 'int' => (string) $defaultValue, |
|
| 660 | + 'int' => (string)$defaultValue, |
|
| 661 | 661 | default => $driver->quote($defaultValue) |
| 662 | 662 | }; |
| 663 | 663 | } |
@@ -671,8 +671,8 @@ discard block |
||
| 671 | 671 | */ |
| 672 | 672 | protected function formatDatetime( |
| 673 | 673 | string $type, |
| 674 | - string|int|\DateTimeInterface $value |
|
| 675 | - ): \DateTimeInterface|FragmentInterface|string { |
|
| 674 | + string | int | \DateTimeInterface $value |
|
| 675 | + ): \DateTimeInterface | FragmentInterface | string { |
|
| 676 | 676 | if ($value === static::DATETIME_NOW) { |
| 677 | 677 | //Dynamic default value |
| 678 | 678 | return new Fragment($value); |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - return match ($type) { |
|
| 693 | + return match($type) { |
|
| 694 | 694 | 'datetime', 'timestamp' => $datetime, |
| 695 | 695 | 'time' => $datetime->format(static::TIME_FORMAT), |
| 696 | 696 | 'date' => $datetime->format(static::DATE_FORMAT), |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | $self = $this; |
| 79 | 79 | return array_map( |
| 80 | - static fn (string $column): string => ($order = $self->sort[$column] ?? null) ? "$column $order" : $column, |
|
| 80 | + static fn(string $column): string => ($order = $self->sort[$column] ?? null) ? "$column $order" : $column, |
|
| 81 | 81 | $this->columns |
| 82 | 82 | ); |
| 83 | 83 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * |
| 105 | 105 | * @return self |
| 106 | 106 | */ |
| 107 | - public function columns(string|array $columns): self |
|
| 107 | + public function columns(string | array $columns): self |
|
| 108 | 108 | { |
| 109 | 109 | if (!\is_array($columns)) { |
| 110 | 110 | $columns = func_get_args(); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | /** |
| 176 | 176 | * Parse column name and order from column expression |
| 177 | 177 | */ |
| 178 | - public static function parseColumn(array|string $column): array |
|
| 178 | + public static function parseColumn(array | string $column): array |
|
| 179 | 179 | { |
| 180 | 180 | if (\is_array($column)) { |
| 181 | 181 | return $column; |