Skip to content

Commit 2212da0

Browse files
committed
support for where x in () queries
1 parent 3a5ce59 commit 2212da0

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

src/BuilderPart/DefaultValue.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Leven\DBA\Common\BuilderPart;
4+
5+
final class DefaultValue
6+
{
7+
}

src/BuilderPart/WhereCondition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class WhereCondition
88
public function __construct(
99
public readonly bool $isOr,
1010
public readonly string $column,
11-
public readonly null|string|bool|int|float $value,
11+
public readonly null|string|bool|int|float|array $value,
1212
public readonly string $operand = '<=>',
1313
)
1414
{

src/BuilderPart/WhereTrait.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ trait WhereTrait
1111

1212
public function andWhere(
1313
string|callable $columnOrGroup,
14-
null|string|bool|int|float|array $valueOrOperand = [],
15-
null|string|bool|int|float|array $value = [],
14+
mixed $valueOrOperand = new DefaultValue,
15+
mixed $value = new DefaultValue,
1616
): static
1717
{
1818
return $this->whereGeneric(false, $columnOrGroup, $valueOrOperand, $value);
1919
}
2020

2121
public function orWhere(
2222
string|callable $columnOrGroup,
23-
null|string|bool|int|float|array $valueOrOperand = [],
24-
null|string|bool|int|float|array $value = [],
23+
mixed $valueOrOperand = new DefaultValue,
24+
mixed $value = new DefaultValue,
2525
): static
2626
{
2727
return $this->whereGeneric(true, $columnOrGroup, $valueOrOperand, $value);
2828
}
2929

3030
public function where(
3131
string|callable $columnOrGroup,
32-
null|string|bool|int|float|array $valueOrOperand = [],
33-
null|string|bool|int|float|array $value = [],
32+
mixed $valueOrOperand = new DefaultValue,
33+
mixed $value = new DefaultValue,
3434
): static
3535
{
3636
return $this->andWhere($columnOrGroup, $valueOrOperand, $value);
@@ -40,8 +40,8 @@ public function where(
4040
protected function whereGeneric(
4141
bool $isOr,
4242
string|callable $columnOrGroup,
43-
null|string|bool|int|float|array $valueOrOperand = [],
44-
null|string|bool|int|float|array $value = [],
43+
mixed $valueOrOperand = new DefaultValue,
44+
mixed $value = new DefaultValue,
4545
// array types because we need to allow use of null values
4646
): static
4747
{

0 commit comments

Comments
 (0)