@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * @param array $options |
| 33 | 33 | */ |
| 34 | 34 | public function __construct( |
| 35 | - string|\Stringable $dsn, |
|
| 35 | + string | \Stringable $dsn, |
|
| 36 | 36 | array $options = [] |
| 37 | 37 | ) { |
| 38 | 38 | parent::__construct($options); |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | */ |
| 105 | 105 | private function dsnValueToString(mixed $value): string |
| 106 | 106 | { |
| 107 | - return match (true) { |
|
| 107 | + return match(true) { |
|
| 108 | 108 | \is_bool($value) => $value ? '1' : '0', |
| 109 | 109 | // TODO Think about escaping special chars in strings |
| 110 | 110 | \is_scalar($value), $value instanceof \Stringable => (string)$value, |
@@ -37,13 +37,13 @@ |
||
| 37 | 37 | ) { |
| 38 | 38 | /** @psalm-suppress ArgumentTypeCoercion */ |
| 39 | 39 | parent::__construct( |
| 40 | - connection: $connection ?? new MemoryConnectionConfig(), |
|
| 41 | - driver: $driver, |
|
| 42 | - reconnect: $reconnect, |
|
| 43 | - timezone: $timezone, |
|
| 44 | - queryCache: $queryCache, |
|
| 45 | - readonlySchema: $readonlySchema, |
|
| 46 | - readonly: $readonly, |
|
| 40 | + connection : $connection ?? new MemoryConnectionConfig(), |
|
| 41 | + driver : $driver, |
|
| 42 | + reconnect : $reconnect, |
|
| 43 | + timezone : $timezone, |
|
| 44 | + queryCache : $queryCache, |
|
| 45 | + readonlySchema : $readonlySchema, |
|
| 46 | + readonly : $readonly, |
|
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function __construct( |
| 45 | 45 | ConnectionConfig $connection, |
| 46 | - iterable|string $schema = self::DEFAULT_SCHEMA, |
|
| 46 | + iterable | string $schema = self::DEFAULT_SCHEMA, |
|
| 47 | 47 | string $driver = PostgresDriver::class, |
| 48 | 48 | bool $reconnect = true, |
| 49 | 49 | string $timezone = 'UTC', |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | * @param iterable<non-empty-string>|non-empty-string $schema |
| 70 | 70 | * @return array<non-empty-string> |
| 71 | 71 | */ |
| 72 | - private function bootSchema(iterable|string $schema): array |
|
| 72 | + private function bootSchema(iterable | string $schema): array |
|
| 73 | 73 | { |
| 74 | 74 | // Cast any schema config variants to array |
| 75 | - $schema = match (true) { |
|
| 75 | + $schema = match(true) { |
|
| 76 | 76 | $schema instanceof \Traversable => \iterator_to_array($schema), |
| 77 | 77 | \is_string($schema) => [$schema], |
| 78 | 78 | default => $schema |
@@ -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 = [] |
@@ -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 = [] |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | |
| 88 | 88 | private function detectType(mixed $value): int |
| 89 | 89 | { |
| 90 | - return match (gettype($value)) { |
|
| 90 | + return match(gettype($value)) { |
|
| 91 | 91 | 'boolean' => PDO::PARAM_BOOL, |
| 92 | 92 | 'integer' => PDO::PARAM_INT, |
| 93 | 93 | 'NULL' => PDO::PARAM_NULL, |
@@ -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 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @param string|array $columns Columns array or comma separated list of parameters. |
| 104 | 104 | * @return self |
| 105 | 105 | */ |
| 106 | - public function columns(string|array $columns): AbstractIndex |
|
| 106 | + public function columns(string | array $columns): AbstractIndex |
|
| 107 | 107 | { |
| 108 | 108 | if (!\is_array($columns)) { |
| 109 | 109 | $columns = func_get_args(); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | /** |
| 174 | 174 | * Parse column name and order from column expression |
| 175 | 175 | */ |
| 176 | - public static function parseColumn(array|string $column): array |
|
| 176 | + public static function parseColumn(array | string $column): array |
|
| 177 | 177 | { |
| 178 | 178 | if (\is_array($column)) { |
| 179 | 179 | return $column; |
@@ -332,11 +332,11 @@ discard block |
||
| 332 | 332 | return $this->formatDatetime($this->getAbstractType(), $this->defaultValue); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - return match ($this->getType()) { |
|
| 336 | - 'int' => (int) $this->defaultValue, |
|
| 337 | - 'float' => (float) $this->defaultValue, |
|
| 335 | + return match($this->getType()) { |
|
| 336 | + 'int' => (int)$this->defaultValue, |
|
| 337 | + 'float' => (float)$this->defaultValue, |
|
| 338 | 338 | 'bool' => \is_string($this->defaultValue) && strtolower($this->defaultValue) === 'false' |
| 339 | - ? false : (bool) $this->defaultValue, |
|
| 339 | + ? false : (bool)$this->defaultValue, |
|
| 340 | 340 | default => (string)$this->defaultValue |
| 341 | 341 | }; |
| 342 | 342 | } |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | * |
| 505 | 505 | * @param string|array $values Enum values (array or comma separated). String values only. |
| 506 | 506 | */ |
| 507 | - public function enum(string|array $values): AbstractColumn |
|
| 507 | + public function enum(string | array $values): AbstractColumn |
|
| 508 | 508 | { |
| 509 | 509 | $this->type('enum'); |
| 510 | 510 | $this->enumValues = array_map( |
@@ -652,10 +652,10 @@ discard block |
||
| 652 | 652 | ); |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | - return match ($this->getType()) { |
|
| 655 | + return match($this->getType()) { |
|
| 656 | 656 | 'bool' => $defaultValue ? 'TRUE' : 'FALSE', |
| 657 | 657 | 'float' => sprintf('%F', $defaultValue), |
| 658 | - 'int' => (string) $defaultValue, |
|
| 658 | + 'int' => (string)$defaultValue, |
|
| 659 | 659 | default => $driver->quote($defaultValue) |
| 660 | 660 | }; |
| 661 | 661 | } |
@@ -668,8 +668,8 @@ discard block |
||
| 668 | 668 | */ |
| 669 | 669 | protected function formatDatetime( |
| 670 | 670 | string $type, |
| 671 | - string|int|\DateTimeInterface $value |
|
| 672 | - ): \DateTimeInterface|FragmentInterface|string { |
|
| 671 | + string | int | \DateTimeInterface $value |
|
| 672 | + ): \DateTimeInterface | FragmentInterface | string { |
|
| 673 | 673 | if ($value === static::DATETIME_NOW) { |
| 674 | 674 | //Dynamic default value |
| 675 | 675 | return new Fragment($value); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | - return match ($type) { |
|
| 690 | + return match($type) { |
|
| 691 | 691 | 'datetime', 'timestamp' => $datetime, |
| 692 | 692 | 'time' => $datetime->format(static::TIME_FORMAT), |
| 693 | 693 | 'date' => $datetime->format(static::DATE_FORMAT), |