@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | protected array $tables = []; |
46 | 46 | protected array $unionTokens = []; |
47 | - protected bool|string|array $distinct = false; |
|
47 | + protected bool | string | array $distinct = false; |
|
48 | 48 | protected array $columns = ['*']; |
49 | 49 | /** @var FragmentInterface[][]|string[][] */ |
50 | 50 | protected array $orderBy = []; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param bool|FragmentInterface|string $distinct You are only allowed to use string value for |
73 | 73 | * Postgres databases. |
74 | 74 | */ |
75 | - public function distinct(bool|string|FragmentInterface $distinct = true): self |
|
75 | + public function distinct(bool | string | FragmentInterface $distinct = true): self |
|
76 | 76 | { |
77 | 77 | $this->distinct = $distinct; |
78 | 78 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param array|string $expression |
134 | 134 | * @param string $direction Sorting direction, ASC|DESC. |
135 | 135 | */ |
136 | - public function orderBy(string|FragmentInterface|array $expression, string $direction = self::SORT_ASC): self |
|
136 | + public function orderBy(string | FragmentInterface | array $expression, string $direction = self::SORT_ASC): self |
|
137 | 137 | { |
138 | 138 | if (!\is_array($expression)) { |
139 | 139 | $this->addOrder($expression, $direction); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * Column or expression to group query by. |
152 | 152 | */ |
153 | - public function groupBy(string|Fragment|Expression $expression): self |
|
153 | + public function groupBy(string | Fragment | Expression $expression): self |
|
154 | 154 | { |
155 | 155 | $this->groupBy[] = $expression; |
156 | 156 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return $this|self |
357 | 357 | */ |
358 | - private function addOrder(string|FragmentInterface $field, string $order): self |
|
358 | + private function addOrder(string | FragmentInterface $field, string $order): self |
|
359 | 359 | { |
360 | 360 | if (!\is_string($field)) { |
361 | 361 | $this->orderBy[] = [$field, $order]; |
@@ -39,9 +39,9 @@ |
||
39 | 39 | * |
40 | 40 | * @return non-empty-string|null |
41 | 41 | */ |
42 | - public static function read(string $haystack, array|string $needle): ?string |
|
42 | + public static function read(string $haystack, array | string $needle): ?string |
|
43 | 43 | { |
44 | - $needle = \array_map(static fn (string $item): string => \preg_quote($item), (array)$needle); |
|
44 | + $needle = \array_map(static fn(string $item) : string => \preg_quote($item), (array)$needle); |
|
45 | 45 | $pattern = \sprintf('/\b(?:%s)=([^;]+)/i', \implode('|', $needle)); |
46 | 46 | |
47 | 47 | if (\preg_match($pattern, $haystack, $matches)) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function __construct( |
44 | 44 | ConnectionConfig $connection, |
45 | - iterable|string $schema = self::DEFAULT_SCHEMA, |
|
45 | + iterable | string $schema = self::DEFAULT_SCHEMA, |
|
46 | 46 | string $driver = PostgresDriver::class, |
47 | 47 | bool $reconnect = true, |
48 | 48 | string $timezone = 'UTC', |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * |
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 |
@@ -36,9 +36,9 @@ |
||
36 | 36 | if ($columns !== []) { |
37 | 37 | foreach ($columns as $column) { |
38 | 38 | // We only need key columns |
39 | - if ((int) ($column['cid']) > -1) { |
|
39 | + if ((int)($column['cid']) > -1) { |
|
40 | 40 | $index->columns[] = $column['name']; |
41 | - if ((int) ($column['desc']) === 1) { |
|
41 | + if ((int)($column['desc']) === 1) { |
|
42 | 42 | $index->sort[$column['name']] = 'DESC'; |
43 | 43 | } |
44 | 44 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | //Fetching enum values |
207 | 207 | if ($options !== [] && $column->getAbstractType() === 'enum') { |
208 | - $column->enumValues = array_map(static fn ($value) => trim($value, $value[0]), $options); |
|
208 | + $column->enumValues = array_map(static fn($value) => trim($value, $value[0]), $options); |
|
209 | 209 | |
210 | 210 | return $column; |
211 | 211 | } |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | */ |
237 | 237 | protected function formatDatetime( |
238 | 238 | string $type, |
239 | - string|int|\DateTimeInterface $value |
|
240 | - ): \DateTimeInterface|FragmentInterface|string { |
|
239 | + string | int | \DateTimeInterface $value |
|
240 | + ): \DateTimeInterface | FragmentInterface | string { |
|
241 | 241 | if ($value === 'current_timestamp()') { |
242 | 242 | $value = self::DATETIME_NOW; |
243 | 243 | } |
@@ -342,7 +342,7 @@ |
||
342 | 342 | |
343 | 343 | |
344 | 344 | |
345 | - ; |
|
345 | + ; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | return $this->type('bigPrimary'); |
163 | 163 | } |
164 | 164 | |
165 | - public function enum(string|array $values): AbstractColumn |
|
165 | + public function enum(string | array $values): AbstractColumn |
|
166 | 166 | { |
167 | 167 | $this->enumValues = array_map('strval', \is_array($values) ? $values : \func_get_args()); |
168 | 168 | |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | return $column; |
300 | 300 | } |
301 | 301 | |
302 | - if (str_contains($column->type, 'char') && (int) $schema['character_maximum_length']) { |
|
302 | + if (str_contains($column->type, 'char') && (int)$schema['character_maximum_length']) { |
|
303 | 303 | $column->size = $schema['character_maximum_length']; |
304 | 304 | } |
305 | 305 | |
306 | 306 | if ($column->type === 'numeric') { |
307 | - $column->precision = (int) $schema['numeric_precision']; |
|
308 | - $column->scale = (int) $schema['numeric_scale']; |
|
307 | + $column->precision = (int)$schema['numeric_precision']; |
|
308 | + $column->scale = (int)$schema['numeric_scale']; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | if ($column->type === 'USER-DEFINED' && $schema['typtype'] === 'e') { |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | return true; |
335 | 335 | } |
336 | 336 | |
337 | - return (bool) ( |
|
337 | + return (bool)( |
|
338 | 338 | in_array($this->getAbstractType(), ['primary', 'bigPrimary']) |
339 | 339 | && $initial->getDefaultValue() != $this->getDefaultValue() |
340 | 340 | ) |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | ); |
187 | 187 | } |
188 | 188 | |
189 | - protected function distinct(QueryParameters $params, Quoter $q, string|bool|array $distinct): string |
|
189 | + protected function distinct(QueryParameters $params, Quoter $q, string | bool | array $distinct): string |
|
190 | 190 | { |
191 | 191 | return $distinct === false ? '' : 'DISTINCT'; |
192 | 192 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | { |
335 | 335 | // let's quote every identifier |
336 | 336 | $columns = array_map( |
337 | - function ($column) use ($params, $q) { |
|
337 | + function($column) use ($params, $q) { |
|
338 | 338 | return $this->name($params, $q, $column); |
339 | 339 | }, |
340 | 340 | $columns |