Skip to content

Commit

Permalink
πŸ”€ Merge pull request #21 from Morning-Train/hotfix/filters
Browse files Browse the repository at this point in the history
πŸ› Allow mixed value as operatororvalue
  • Loading branch information
mschadegg authored Feb 29, 2024
2 parents 8f16cbd + d3e3680 commit 26a19cd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Classes/EconomicQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function getEndpoint(): string
return $this->endpoint;
}

public function where(int|string|Closure $propertyName, ?string $operatorOrValue = null, mixed $value = null): static
public function where(int|string|Closure $propertyName, mixed $operatorOrValue = null, mixed $value = null): static
{
if (! isset($this->filter)) {
$this->filter = new EconomicQueryFilterBuilder(EconomicQueryFilterBuilder::FILTER_RELATION_AND);
Expand All @@ -53,7 +53,7 @@ public function where(int|string|Closure $propertyName, ?string $operatorOrValue
return $this;
}

public function orWhere(int|string|Closure $propertyName, ?string $operatorOrValue = null, mixed $value = null): static
public function orWhere(int|string|Closure $propertyName, mixed $operatorOrValue = null, mixed $value = null): static
{
if (! isset($this->filter)) {
$this->filter = new EconomicQueryFilterBuilder(EconomicQueryFilterBuilder::FILTER_RELATION_OR);
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/EconomicQueryFilterBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function whereNested(Closure $closure)
return $this;
}

public function where(int|string|Closure $propertyName, ?string $operatorOrValue = null, mixed $value = null): static
public function where(int|string|Closure $propertyName, mixed $operatorOrValue = null, mixed $value = null): static
{
if ($propertyName instanceof Closure) {
return $this->whereNested($propertyName);
Expand Down Expand Up @@ -144,7 +144,7 @@ public function where(int|string|Closure $propertyName, ?string $operatorOrValue
return $this;
}

public function orWhere(int|string|Closure $propertyName, ?string $operatorOrValue = null, mixed $value = null): static
public function orWhere(int|string|Closure $propertyName, mixed $operatorOrValue = null, mixed $value = null): static
{
$instance = new static(static::FILTER_RELATION_OR);

Expand Down
2 changes: 1 addition & 1 deletion src/Classes/EconomicRelatedResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function find(string|int $reference): ?Resource
/**
* @return EconomicQueryBuilder<R>
*/
public function where(int|string $propertyName, string $operatorOrValue, mixed $value = null): EconomicQueryBuilder
public function where(int|string $propertyName, mixed $operatorOrValue = null, mixed $value = null): EconomicQueryBuilder
{
return (new EconomicQueryBuilder($this->resourceClass))->setEndpoint($this->endpointCollection->getEndpoint($this->references))->where($propertyName, $operatorOrValue, $value);

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Resources/GetCollectionable.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait GetCollectionable
/**
* @return EconomicQueryBuilder<ResourceClass>
*/
public static function where(int|string $propertyName, string $operatorOrValue, mixed $value = null): EconomicQueryBuilder
public static function where(int|string $propertyName, mixed $operatorOrValue = null, mixed $value = null): EconomicQueryBuilder
{
return (new EconomicQueryBuilder(static::class))->where($propertyName, $operatorOrValue, $value);
}
Expand Down

0 comments on commit 26a19cd

Please sign in to comment.