@@ -107,7 +107,7 @@ |
||
| 107 | 107 | return (object) []; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function first(): string|int|float|null |
|
| 110 | + public function first(): string | int | float | null |
|
| 111 | 111 | { |
| 112 | 112 | return 0; |
| 113 | 113 | } |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | private readonly bool $unsigned = false, |
| 36 | 36 | private readonly bool $fixed = false, |
| 37 | 37 | private readonly bool $nullable = false, |
| 38 | - private readonly float|int|string|null $default = null, |
|
| 38 | + private readonly float | int | string | null $default = null, |
|
| 39 | 39 | private readonly bool $autoincrement = false, |
| 40 | - private readonly string|null $collation = null, |
|
| 40 | + private readonly string | null $collation = null, |
|
| 41 | 41 | ) { |
| 42 | 42 | parent::__construct( |
| 43 | 43 | name: $name, |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function default(float|int|string $default): self |
|
| 76 | + public function default(float | int | string $default): self |
|
| 77 | 77 | { |
| 78 | 78 | return new self( |
| 79 | 79 | name: $this->name, |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | /** |
| 30 | 30 | * @param array<int,string> $columns |
| 31 | 31 | */ |
| 32 | - public function __construct(private readonly array $columns, string|null $name = null) |
|
| 32 | + public function __construct(private readonly array $columns, string | null $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | parent::__construct(name: $name, columns: $this->columns); |
| 35 | 35 | } |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | /** |
| 33 | 33 | * @param array<int,string> $columns |
| 34 | 34 | */ |
| 35 | - public function __construct(private readonly array $columns, string|null $name = null) |
|
| 35 | + public function __construct(private readonly array $columns, string | null $name = null) |
|
| 36 | 36 | { |
| 37 | 37 | parent::__construct(name: $name, columns: $this->columns, isUnique: true); |
| 38 | 38 | } |
@@ -45,13 +45,13 @@ discard block |
||
| 45 | 45 | /** @var array<int,ForeignKey> */ |
| 46 | 46 | private array $foreign_keys; |
| 47 | 47 | |
| 48 | - public function __construct(private readonly string $name, Column|Index|UniqueIndex|ForeignKey|PrimaryKey ...$components) |
|
| 48 | + public function __construct(private readonly string $name, Column | Index | UniqueIndex | ForeignKey | PrimaryKey ...$components) |
|
| 49 | 49 | { |
| 50 | - $column_filter = static fn (Column|Index|UniqueIndex|ForeignKey|PrimaryKey $component): bool => $component instanceof Column; |
|
| 51 | - $foreign_key_filter = static fn (Column|Index|UniqueIndex|ForeignKey|PrimaryKey $component): bool => $component instanceof ForeignKey; |
|
| 52 | - $index_filter = static fn (Column|Index|UniqueIndex|ForeignKey|PrimaryKey $component): bool => $component instanceof Index; |
|
| 53 | - $primary_key_filter = static fn (Column|Index|UniqueIndex|ForeignKey|PrimaryKey $component): bool => $component instanceof PrimaryKey; |
|
| 54 | - $unique_index_filter = static fn (Column|Index|UniqueIndex|ForeignKey|PrimaryKey $component): bool => $component instanceof UniqueIndex; |
|
| 50 | + $column_filter = static fn (Column | Index | UniqueIndex | ForeignKey | PrimaryKey $component): bool => $component instanceof Column; |
|
| 51 | + $foreign_key_filter = static fn (Column | Index | UniqueIndex | ForeignKey | PrimaryKey $component): bool => $component instanceof ForeignKey; |
|
| 52 | + $index_filter = static fn (Column | Index | UniqueIndex | ForeignKey | PrimaryKey $component): bool => $component instanceof Index; |
|
| 53 | + $primary_key_filter = static fn (Column | Index | UniqueIndex | ForeignKey | PrimaryKey $component): bool => $component instanceof PrimaryKey; |
|
| 54 | + $unique_index_filter = static fn (Column | Index | UniqueIndex | ForeignKey | PrimaryKey $component): bool => $component instanceof UniqueIndex; |
|
| 55 | 55 | |
| 56 | 56 | $this->columns = array_values(array: array_filter(array: $components, callback: $column_filter)); |
| 57 | 57 | $this->foreign_keys = array_values(array: array_filter(array: $components, callback: $foreign_key_filter)); |
@@ -73,21 +73,21 @@ discard block |
||
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - private function namedIndex(Index &$index, int|string $n): void |
|
| 76 | + private function namedIndex(Index & $index, int | string $n): void |
|
| 77 | 77 | { |
| 78 | 78 | $n = 1 + (int) $n; |
| 79 | 79 | $name = DB::prefix($this->name . '_ix' . $n); |
| 80 | 80 | $index = $index->name($name); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - private function namedUniqueIndex(UniqueIndex &$unique_index, int|string $n): void |
|
| 83 | + private function namedUniqueIndex(UniqueIndex & $unique_index, int | string $n): void |
|
| 84 | 84 | { |
| 85 | 85 | $n = 1 + (int) $n; |
| 86 | 86 | $name = DB::prefix($this->name . '_ux' . $n); |
| 87 | 87 | $unique_index = $unique_index->name($name); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - private function namedForeignKey(ForeignKey &$foreign_key, int|string $n): void |
|
| 90 | + private function namedForeignKey(ForeignKey & $foreign_key, int | string $n): void |
|
| 91 | 91 | { |
| 92 | 92 | $n = 1 + (int) $n; |
| 93 | 93 | $name = DB::prefix($this->name . '_fk' . $n); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return TValue|null |
| 76 | 76 | */ |
| 77 | - public function first(Closure|null $closure = null): mixed |
|
| 77 | + public function first(Closure | null $closure = null): mixed |
|
| 78 | 78 | { |
| 79 | 79 | foreach ($this->getArrayCopy() as $value) { |
| 80 | 80 | if ($closure === null || $closure($value)) { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return TValue|null |
| 92 | 92 | */ |
| 93 | - public function last(Closure|null $closure = null): mixed |
|
| 93 | + public function last(Closure | null $closure = null): mixed |
|
| 94 | 94 | { |
| 95 | 95 | return $this->reverse()->first(closure: $closure); |
| 96 | 96 | } |