@@ -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), |
@@ -730,7 +730,7 @@ |
||
730 | 730 | foreach ($target->getForeignKeys() as $foreign) { |
731 | 731 | $foreign->columns( |
732 | 732 | array_map( |
733 | - static fn ($column) => $column === $initial->getName() ? $name->getName() : $column, |
|
733 | + static fn($column) => $column === $initial->getName() ? $name->getName() : $column, |
|
734 | 734 | $foreign->getColumns() |
735 | 735 | ) |
736 | 736 | ); |
@@ -110,7 +110,7 @@ |
||
110 | 110 | * |
111 | 111 | * @throws BuilderException |
112 | 112 | */ |
113 | - public function insertOne(array $rowset = []): int|string|null |
|
113 | + public function insertOne(array $rowset = []): int | string | null |
|
114 | 114 | { |
115 | 115 | return $this->database |
116 | 116 | ->insert($this->name) |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | if ($driverObject instanceof LoggerAwareInterface) { |
162 | 162 | $logger = $this->getLoggerForDriver($driverObject); |
163 | - if (! $logger instanceof NullLogger) { |
|
163 | + if (!$logger instanceof NullLogger) { |
|
164 | 164 | $driverObject->setLogger($logger); |
165 | 165 | } |
166 | 166 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | private function getLoggerForDriver(DriverInterface $driver): LoggerInterface |
200 | 200 | { |
201 | - if (! $this->loggerFactory) { |
|
201 | + if (!$this->loggerFactory) { |
|
202 | 202 | return $this->logger ??= new NullLogger(); |
203 | 203 | } |
204 | 204 |
@@ -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 string[][]|FragmentInterface[][] */ |
50 | 50 | protected array $orderBy = []; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param bool|string|FragmentInterface $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): SelectQuery |
|
75 | + public function distinct(bool | string | FragmentInterface $distinct = true): SelectQuery |
|
76 | 76 | { |
77 | 77 | $this->distinct = $distinct; |
78 | 78 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string|array $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): SelectQuery |
|
136 | + public function orderBy(string | FragmentInterface | array $expression, string $direction = self::SORT_ASC): SelectQuery |
|
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): SelectQuery |
|
153 | + public function groupBy(string | Fragment | Expression $expression): SelectQuery |
|
154 | 154 | { |
155 | 155 | $this->groupBy[] = $expression; |
156 | 156 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * @param string $order Sorting direction, ASC|DESC. |
355 | 355 | * @return self|$this |
356 | 356 | */ |
357 | - private function addOrder(string|FragmentInterface $field, string $order): SelectQuery |
|
357 | + private function addOrder(string | FragmentInterface $field, string $order): SelectQuery |
|
358 | 358 | { |
359 | 359 | if (!\is_string($field)) { |
360 | 360 | $this->orderBy[] = [$field, $order]; |
@@ -104,7 +104,7 @@ |
||
104 | 104 | */ |
105 | 105 | private function whereWrapper(): Closure |
106 | 106 | { |
107 | - return static function ($parameter) { |
|
107 | + return static function($parameter) { |
|
108 | 108 | \is_array($parameter) and throw new BuilderException('Arrays must be wrapped with Parameter instance'); |
109 | 109 | |
110 | 110 | return !$parameter instanceof ParameterInterface && !$parameter instanceof FragmentInterface |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * Name/id of last join, every ON and ON WHERE call will be associated with this join. |
65 | 65 | */ |
66 | - private int|string|null $lastJoin = null; |
|
66 | + private int | string | null $lastJoin = null; |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Register new JOIN with specified type with set of on conditions (linking one table to |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @throws BuilderException |
79 | 79 | */ |
80 | 80 | public function join( |
81 | - ActiveQuery|string $type, |
|
82 | - string|ActiveQuery $outer, |
|
81 | + ActiveQuery | string $type, |
|
82 | + string | ActiveQuery $outer, |
|
83 | 83 | string $alias = null, |
84 | 84 | mixed $on = null |
85 | 85 | ): self { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @throws BuilderException |
115 | 115 | */ |
116 | - public function innerJoin(ActiveQuery|string $outer, string $alias = null): self |
|
116 | + public function innerJoin(ActiveQuery | string $outer, string $alias = null): self |
|
117 | 117 | { |
118 | 118 | $this->joinTokens[++$this->lastJoin] = [ |
119 | 119 | 'outer' => $outer, |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @throws BuilderException |
141 | 141 | */ |
142 | - public function rightJoin(ActiveQuery|string $outer, string $alias = null, mixed $on = null): self |
|
142 | + public function rightJoin(ActiveQuery | string $outer, string $alias = null, mixed $on = null): self |
|
143 | 143 | { |
144 | 144 | $this->joinTokens[++$this->lastJoin] = [ |
145 | 145 | 'outer' => $outer, |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @throws BuilderException |
166 | 166 | */ |
167 | - public function leftJoin(ActiveQuery|string $outer, string $alias = null): self |
|
167 | + public function leftJoin(ActiveQuery | string $outer, string $alias = null): self |
|
168 | 168 | { |
169 | 169 | $this->joinTokens[++$this->lastJoin] = [ |
170 | 170 | 'outer' => $outer, |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @return $this |
193 | 193 | */ |
194 | - public function fullJoin(ActiveQuery|string $outer, string $alias = null): self |
|
194 | + public function fullJoin(ActiveQuery | string $outer, string $alias = null): self |
|
195 | 195 | { |
196 | 196 | $this->joinTokens[++$this->lastJoin] = [ |
197 | 197 | 'outer' => $outer, |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | private function onWrapper(): Closure |
353 | 353 | { |
354 | - return static fn ($parameter) => |
|
354 | + return static fn($parameter) => |
|
355 | 355 | $parameter instanceof FragmentInterface || $parameter instanceof ParameterInterface |
356 | 356 | ? $parameter |
357 | 357 | : new Expression($parameter); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | private function onWhereWrapper(): Closure |
364 | 364 | { |
365 | - return static function ($parameter) { |
|
365 | + return static function($parameter) { |
|
366 | 366 | \is_array($parameter) and throw new BuilderException('Arrays must be wrapped with Parameter instance'); |
367 | 367 | |
368 | 368 | //Wrapping all values with ParameterInterface |